pamac-tray refreshes its status if pacman was run and fixes
This commit is contained in:
parent
ead2927d37
commit
eb5d87a500
40
pamac-check_updates.py
Executable file
40
pamac-check_updates.py
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
#! /usr/bin/python3
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
# pamac - A Python implementation of alpm
|
||||||
|
# Copyright (C) 2013 Guillaume Benoit <guillaume@manjaro.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
from gi.repository import GObject
|
||||||
|
from pamac import common, transaction
|
||||||
|
import dbus
|
||||||
|
|
||||||
|
def handle_updates(updates):
|
||||||
|
transaction.StopDaemon()
|
||||||
|
loop.quit()
|
||||||
|
|
||||||
|
loop = GObject.MainLoop()
|
||||||
|
|
||||||
|
if not common.pid_file_exists():
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
bus.add_signal_receiver(handle_updates, dbus_interface = "org.manjaro.pamac", signal_name = "EmitAvailableUpdates")
|
||||||
|
transaction.get_dbus_methods()
|
||||||
|
try:
|
||||||
|
transaction.CheckUpdates()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
loop.run()
|
@ -29,16 +29,19 @@ def handle_reply(reply):
|
|||||||
|
|
||||||
def handle_error(error):
|
def handle_error(error):
|
||||||
transaction.StopDaemon()
|
transaction.StopDaemon()
|
||||||
|
common.rm_pid_file()
|
||||||
print('check updates failed')
|
print('check updates failed')
|
||||||
loop.quit()
|
loop.quit()
|
||||||
|
|
||||||
def handle_updates(updates):
|
def handle_updates(updates):
|
||||||
|
common.rm_pid_file()
|
||||||
transaction.StopDaemon()
|
transaction.StopDaemon()
|
||||||
loop.quit()
|
loop.quit()
|
||||||
|
|
||||||
loop = GObject.MainLoop()
|
loop = GObject.MainLoop()
|
||||||
|
|
||||||
if not common.pid_file_exists():
|
if not common.pid_file_exists():
|
||||||
|
common.write_pid_file()
|
||||||
print('checking updates')
|
print('checking updates')
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone")
|
bus.add_signal_receiver(handle_reply, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTransactionDone")
|
||||||
|
20
pamac-tray.py
Normal file → Executable file
20
pamac-tray.py
Normal file → Executable file
@ -23,6 +23,7 @@ from subprocess import call
|
|||||||
import dbus
|
import dbus
|
||||||
from dbus.mainloop.glib import DBusGMainLoop
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
from pamac import common
|
from pamac import common
|
||||||
|
|
||||||
@ -92,6 +93,24 @@ class Tray:
|
|||||||
|
|
||||||
def refresh():
|
def refresh():
|
||||||
Thread(target = call, args = (['/usr/bin/pamac-refresh'],)).start()
|
Thread(target = call, args = (['/usr/bin/pamac-refresh'],)).start()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def check_updates():
|
||||||
|
Thread(target = call, args = (['/usr/bin/pamac-check_updates'],)).start()
|
||||||
|
|
||||||
|
locked = False
|
||||||
|
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):
|
def set_icon(update_data):
|
||||||
global icon
|
global icon
|
||||||
@ -118,4 +137,5 @@ tray = Tray()
|
|||||||
Notify.init(_('Update Manager'))
|
Notify.init(_('Update Manager'))
|
||||||
refresh()
|
refresh()
|
||||||
GObject.timeout_add(3*3600*1000, refresh)
|
GObject.timeout_add(3*3600*1000, refresh)
|
||||||
|
GObject.idle_add(check_pacman_running)
|
||||||
Gtk.main()
|
Gtk.main()
|
||||||
|
0
pamac-updater.py
Normal file → Executable file
0
pamac-updater.py
Normal file → Executable file
@ -49,6 +49,9 @@ from pamac import config
|
|||||||
pid_file = '/tmp/pamac.pid'
|
pid_file = '/tmp/pamac.pid'
|
||||||
lock_file = join(config.pacman_conf.options['DBPath'], 'db.lck')
|
lock_file = join(config.pacman_conf.options['DBPath'], 'db.lck')
|
||||||
|
|
||||||
|
def lock_file_exists():
|
||||||
|
return isfile(lock_file)
|
||||||
|
|
||||||
def pid_file_exists():
|
def pid_file_exists():
|
||||||
return isfile(pid_file)
|
return isfile(pid_file)
|
||||||
|
|
||||||
|
2
po/id.po
2
po/id.po
@ -343,7 +343,7 @@ msgstr "Beberapa pemutakhiran tersedia.\nHarap mutakhirkan sistem terlebih dahul
|
|||||||
msgid ""
|
msgid ""
|
||||||
"{pkgname} is provided by {number} packages.\n"
|
"{pkgname} is provided by {number} packages.\n"
|
||||||
"Please choose those you would like to install:"
|
"Please choose those you would like to install:"
|
||||||
msgstr "{pkgname{ disediakan oleh {number} paket.\nHarap pilih yang ingin kamu instal:"
|
msgstr "{pkgname} disediakan oleh {number} paket.\nHarap pilih yang ingin kamu instal:"
|
||||||
|
|
||||||
#: pamac/transaction.py:233
|
#: pamac/transaction.py:233
|
||||||
msgid "Refreshing"
|
msgid "Refreshing"
|
||||||
|
Loading…
Reference in New Issue
Block a user