def check_pacman_running(): global locked if locked: if not common.lock_file_exists(): locked = False check_updates() else: if common.lock_file_exists(): if not common.pid_file_exists(): locked = True sleep(0.5) return True
def set_icon(update_data): global icon global info syncfirst, updates = update_data if updates: icon = update_icon if len(updates) == 1: info = one_update_info else: info = update_info.format(number = len(updates)) if not common.pid_file_exists(): Notify.Notification.new(_('Update Manager'), info, 'system-software-update').show() else: icon = noupdate_icon info = noupdate_info print(info) tray.update_icon(icon, info)
def set_icon(update_data): global icon global info syncfirst, updates = update_data if updates: icon = update_icon if len(updates) == 1: info = one_update_info else: info = update_info.format(number=len(updates)) if not common.pid_file_exists(): Notify.Notification.new(_('Update Manager'), info, 'system-software-update').show() else: icon = noupdate_icon info = noupdate_info print(info) tray.update_icon(icon, info)
def main(_mode): if common.pid_file_exists(): transaction.ErrorDialog.format_secondary_text("Another instance of Pamac is running") response = transaction.ErrorDialog.run() if response: transaction.ErrorDialog.hide() else: common.write_pid_file() global mode mode = _mode interface.connect_signals(Handler()) do_refresh() if mode == "manager": ManagerWindow.show_all() if mode == "updater": update_label.set_markup("<big><b>Available updates</b></big>") UpdaterWindow.show_all() while Gtk.events_pending(): Gtk.main_iteration() Gtk.main()
def handle_error(error): transaction.StopDaemon() common.rm_pid_file() print('check updates failed') loop.quit() def handle_updates(updates): common.rm_pid_file() transaction.StopDaemon() loop.quit() loop = GObject.MainLoop() if not common.pid_file_exists(): common.write_pid_file() print('checking updates') bus = dbus.SystemBus() bus.add_signal_receiver(handle_reply, dbus_interface="org.manjaro.pamac", signal_name="EmitTransactionDone") bus.add_signal_receiver(handle_error, dbus_interface="org.manjaro.pamac", signal_name="EmitTransactionError") bus.add_signal_receiver(handle_updates, dbus_interface="org.manjaro.pamac", signal_name="EmitAvailableUpdates") transaction.get_dbus_methods() try: transaction.Refresh(False)
'on_ProgressCloseButton_clicked' : on_ProgressCloseButton_clicked, 'on_ProgressCancelButton_clicked' : on_ProgressCancelButton_clicked, 'on_UpdaterWindow_delete_event' : on_UpdaterWindow_delete_event, 'on_UpdaterPreferencesButton_clicked': on_UpdaterPreferencesButton_clicked, 'on_Updater_ApplyButton_clicked' : on_Updater_ApplyButton_clicked, 'on_Updater_RefreshButton_clicked' : on_Updater_RefreshButton_clicked, 'on_Updater_CloseButton_clicked' : on_Updater_CloseButton_clicked} def config_dbus_signals(): bus = dbus.SystemBus() bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone") bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError") bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates") bus.add_signal_receiver(reload_config, dbus_interface = "org.manjaro.pamac", signal_name = "EmitReloadConfig") if common.pid_file_exists(): transaction.ErrorDialog.format_secondary_text(_('Pamac is already running')) response = transaction.ErrorDialog.run() if response: transaction.ErrorDialog.hide() else: common.write_pid_file() interface.connect_signals(signals) transaction.get_dbus_methods() transaction.config_dbus_signals() config_dbus_signals() UpdaterWindow.show() UpdaterWindow.get_window().set_cursor(Gdk.Cursor(Gdk.CursorType.WATCH)) while Gtk.events_pending(): Gtk.main_iteration() transaction.refresh()
bus = dbus.SystemBus() bus.add_signal_receiver(handle_reply, dbus_interface="org.manjaro.pamac", signal_name="EmitTransactionDone") bus.add_signal_receiver(handle_error, dbus_interface="org.manjaro.pamac", signal_name="EmitTransactionError") bus.add_signal_receiver(handle_updates, dbus_interface="org.manjaro.pamac", signal_name="EmitAvailableUpdates") bus.add_signal_receiver(reload_config, dbus_interface="org.manjaro.pamac", signal_name="EmitReloadConfig") if common.pid_file_exists(): transaction.ErrorDialog.format_secondary_text( _('Pamac is already running')) response = transaction.ErrorDialog.run() if response: transaction.ErrorDialog.hide() else: common.write_pid_file() interface.connect_signals(signals) transaction.get_dbus_methods() transaction.config_dbus_signals() config_dbus_signals() state_column.set_cell_data_func(state_rendererpixbuf, state_column_display_func) name_column.set_cell_data_func(name_renderertext, name_column_display_func) version_column.set_cell_data_func(version_renderertext,
print('check updates done') transaction.CheckUpdates() def handle_error(error): transaction.StopDaemon() common.rm_pid_file() print('check updates failed') loop.quit() def handle_updates(updates): common.rm_pid_file() transaction.StopDaemon() loop.quit() loop = GObject.MainLoop() if not common.pid_file_exists(): common.write_pid_file() print('checking updates') bus = dbus.SystemBus() bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone") bus.add_signal_receiver(handle_error, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionError") bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates") transaction.get_dbus_methods() try: transaction.Refresh(False) except: pass else: loop.run()