use backend package

This commit is contained in:
guinux 2012-12-24 15:42:49 +01:00
parent faf0065468
commit 520648ac58
6 changed files with 12 additions and 19 deletions

0
backend/__init__.py Executable file
View File

View File

@ -6,7 +6,7 @@ from gi.repository import Gtk
import pyalpm
import traceback
import sys
import config
from backend import config
interface = Gtk.Builder()
interface.add_from_file('gui/dialogs.glade')
@ -299,6 +299,9 @@ def cb_event(ID, event, tupel):
if ID is 27:
progress_label.set_text('Downloading '+format_size(total_size))
print('Downloading a file')
if ID is 17:
progress_label.set_text('Checking signatures')
print('Checking signatures')
progress_bar.set_fraction(0.0)
progress_bar.set_text('')
print(ID,event)

View File

@ -142,12 +142,12 @@
<property name="width_request">250</property>
<property name="height_request">60</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Transaction progress</property>
<property name="title" translatable="yes">Progress</property>
<property name="resizable">False</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">250</property>
<property name="default_height">60</property>
<signal name="delete-event" handler="on_ProgressWindow_delete_event" swapped="no"/>
<property name="deletable">False</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">True</property>

View File

@ -8,9 +8,8 @@ import math
import sys
from time import strftime, localtime
from os import geteuid
import config
import transaction
import traceback
from backend import transaction, config
interface = Gtk.Builder()
interface.add_from_file('gui/pamac.glade')
@ -187,9 +186,6 @@ def set_desc(pkg, style):
package_desc.append(['Backup files:', '\n'.join(["%s %s" % (md5, file) for (file, md5) in pkg.backup])])
class Handler:
def on_ProgressWindow_delete_event(self, *arg):
pass
def on_MainWindow_delete_event(self, *arg):
Gtk.main_quit()

View File

@ -6,8 +6,7 @@ from gi.repository import Gtk, GdkPixbuf, Gdk
import pyalpm
from time import strftime, localtime
from os import geteuid
import config
import transaction
from backend import transaction
interface = Gtk.Builder()
interface.add_from_file('gui/pamac_update.glade')
@ -19,8 +18,10 @@ top_label = interface.get_object('top_label')
def have_updates():
available_updates = transaction.get_updates()
update_listore.clear()
top_label.set_justify(Gtk.Justification.CENTER)
if not available_updates:
update_listore.append(["", ""])
top_label.set_markup("<big><b>No update available</b></big>")
return False
else:
for pkg in available_updates:
@ -28,6 +29,7 @@ def have_updates():
newversion = transaction.get_new_version_available(pkgname)
pkgname = pkg.name+" "+newversion
update_listore.append([pkgname, transaction.format_size(pkg.size)])
top_label.set_markup("<big><b>Available updates</b></big>")
return True
class Handler:
@ -45,16 +47,8 @@ class Handler:
transaction.do_refresh()
have_updates()
def on_ProgressWindow_delete_event(self, *arg):
pass
def main():
update = have_updates()
top_label.set_justify(Gtk.Justification.CENTER)
if update is False:
top_label.set_markup("<big><b>No update available</b></big>")
else:
top_label.set_markup("<big><b>Available updates</b></big>")
have_updates()
interface.connect_signals(Handler())
UpdateWindow = interface.get_object("UpdateWindow")
UpdateWindow.show_all()