urukupdater.py 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Uruk Update Manager
  5. #
  6. # Copyright 2022 hayder majid <hayder@riseup.net>
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  21. # MA 02110-1301, USA.
  22. import os
  23. import signal
  24. import gi
  25. gi.require_version('Gtk', '3.0')
  26. from gi.repository import Gtk as gtk
  27. try:
  28. gi.require_version('AyatanaAppIndicator3', '0.1')
  29. from gi.repository import AyatanaAppIndicator3 as appindicator
  30. except ValueError:
  31. gi.require_version('AppIndicator3', '0.1')
  32. from gi.repository import AppIndicator3 as appindicator
  33. gi.require_version('Gtk', '3.0')
  34. APPINDICATOR_ID = 'urukupdater'
  35. app_ico = '/usr/share/urukUpdater/pixmap/logo/logo.svg'
  36. def main():
  37. indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.path.abspath(app_ico), appindicator.IndicatorCategory.SYSTEM_SERVICES)
  38. indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
  39. indicator.set_menu(build_menu())
  40. gtk.main()
  41. def build_menu():
  42. menu = gtk.Menu()
  43. # software_cen = gtk.MenuItem('Software Center')
  44. # software_cen.connect('activate', software_center)
  45. # menu.append(software_cen)
  46. status_sys = gtk.MenuItem('Status')
  47. status_sys.connect('activate', status_s)
  48. menu.append(status_sys)
  49. update_sys = gtk.MenuItem('Update System')
  50. update_sys.connect('activate', update_system)
  51. menu.append(update_sys)
  52. about_app = gtk.MenuItem('Preferences')
  53. about_app.connect('activate', settings)
  54. menu.append(about_app)
  55. quit_app = gtk.MenuItem('Quit')
  56. quit_app.connect('activate', quit)
  57. menu.append(quit_app)
  58. menu.show_all()
  59. return menu
  60. # def software_center(source):
  61. # os.system('pkexec /usr/sbin/synaptic')
  62. def status_s(source):
  63. os.system('/usr/lib/urukUpdater/status-sys')
  64. def update_system(source):
  65. os.system('sudo /usr/lib/urukUpdater/checker | zenity --title="System Updating Info" --text="Checking your System for updates \n \n this may take a few minutes depending on your speed connection...." --no-cancel --progress --pulsate --width=400 --height=140 --auto-kill --auto-close --window-icon=/usr/share/urukUpdater/pixmap/wait.svg')
  66. os.system('/usr/share/urukUpdater/updater-status')
  67. def settings(source):
  68. os.system('python3 /usr/share/urukUpdater/uruk-conf.py')
  69. def quit(source):
  70. os.system('/usr/lib/urukUpdater/end_proc')
  71. gtk.main_quit()
  72. if __name__ == "__main__":
  73. signal.signal(signal.SIGINT, signal.SIG_DFL)
  74. main()