Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
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()
Esempio n. 6
0
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)
Esempio n. 7
0
		'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()
Esempio n. 8
0
    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,
Esempio n. 9
0
	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()