From 520648ac5874f462ea857e7754487e6d3ac22915 Mon Sep 17 00:00:00 2001 From: guinux Date: Mon, 24 Dec 2012 15:42:49 +0100 Subject: [PATCH] use backend package --- backend/__init__.py | 0 config.py => backend/config.py | 0 transaction.py => backend/transaction.py | 5 ++++- gui/dialogs.glade | 4 ++-- pamac.py | 6 +----- pamac_update.py | 16 +++++----------- 6 files changed, 12 insertions(+), 19 deletions(-) create mode 100755 backend/__init__.py rename config.py => backend/config.py (100%) rename transaction.py => backend/transaction.py (98%) diff --git a/backend/__init__.py b/backend/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/config.py b/backend/config.py similarity index 100% rename from config.py rename to backend/config.py diff --git a/transaction.py b/backend/transaction.py similarity index 98% rename from transaction.py rename to backend/transaction.py index 78b6bb4..9968ce6 100755 --- a/transaction.py +++ b/backend/transaction.py @@ -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) diff --git a/gui/dialogs.glade b/gui/dialogs.glade index 4531d03..81ce7cb 100644 --- a/gui/dialogs.glade +++ b/gui/dialogs.glade @@ -142,12 +142,12 @@ 250 60 False - Transaction progress + Progress False center-on-parent 250 60 - + False True diff --git a/pamac.py b/pamac.py index 0473aaf..6ea3ebf 100755 --- a/pamac.py +++ b/pamac.py @@ -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() diff --git a/pamac_update.py b/pamac_update.py index ccdc386..7927503 100755 --- a/pamac_update.py +++ b/pamac_update.py @@ -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("No update available") 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("Available updates") 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("No update available") - else: - top_label.set_markup("Available updates") + have_updates() interface.connect_signals(Handler()) UpdateWindow = interface.get_object("UpdateWindow") UpdateWindow.show_all()