From b331df8394cb96463d558c16c2f70fdd7bf042a7 Mon Sep 17 00:00:00 2001 From: guinux Date: Tue, 26 Mar 2013 11:02:17 +0100 Subject: [PATCH] work on display sizes --- gui/manager.glade | 543 ++++++++++++++++++++++++---------------------- gui/updater.glade | 108 +++++---- pamac/main.py | 62 +++--- setup.py | 4 +- 4 files changed, 375 insertions(+), 342 deletions(-) diff --git a/gui/manager.glade b/gui/manager.glade index 3c7c45c..5c17e55 100644 --- a/gui/manager.glade +++ b/gui/manager.glade @@ -1,263 +1,6 @@ - - False - 5 - - True - center-on-parent - dialog - True - False - ManagerWindow - - - False - vertical - 2 - - - False - end - - - gtk-ok - True - True - True - True - - - - False - True - 0 - - - - - False - True - end - 0 - - - - - True - False - label - - - False - True - 1 - - - - - True - True - in - 300 - 250 - - - True - True - choose_list - False - False - False - 0 - - - - - - column - - - - - - 0 - - - - - - 1 - - - - - - - - - True - True - 2 - - - - - - ChooseButton - - - - False - 5 - 5 - - True - center-on-parent - 350 - 250 - /usr/share/pamac/icons/22x22/status/package-info.png - dialog - True - False - ManagerWindow - - - True - False - vertical - - - True - False - label - - - False - True - 0 - - - - - True - True - True - True - in - 300 - 250 - - - True - True - True - True - transaction_sum - False - False - False - 0 - - - - - - column - - - 0 - 600 - - - 0 - - - - - - - column - - - - 1 - - - - - - - - - True - True - 1 - - - - - True - False - label - - - False - True - 2 - - - - - True - False - 7 - 7 - 9 - 7 - True - end - - - gtk-cancel - True - True - True - True - - - - False - True - 0 - - - - - gtk-ok - True - True - True - True - - - - False - True - 1 - - - - - False - True - 3 - - - - - 800 500 @@ -526,8 +269,6 @@ True True packages_list - True - False 0 False @@ -537,11 +278,12 @@ + True autosize Installed True True - + 1 15 @@ -566,11 +308,12 @@ + True autosize Name True True - + 0 0 @@ -581,6 +324,22 @@ + + + True + autosize + Size + True + True + 6 + + + + 5 + + + + @@ -752,6 +511,264 @@ + + False + 5 + + True + center-on-parent + dialog + True + False + ManagerWindow + + + False + vertical + 2 + + + False + end + + + gtk-ok + True + True + True + True + + + + False + True + 0 + + + + + False + True + end + 0 + + + + + True + False + label + + + False + True + 1 + + + + + True + True + in + 300 + 250 + + + True + True + choose_list + False + False + False + 0 + + + + + + column + + + + + + 0 + + + + + + 1 + + + + + + + + + True + True + 2 + + + + + + ChooseButton + + + + False + 5 + 5 + + True + center-on-parent + 350 + 250 + /usr/share/pamac/icons/22x22/status/package-info.png + dialog + True + False + ManagerWindow + + + True + False + vertical + 4 + + + True + False + label + + + False + True + 0 + + + + + True + True + True + True + in + 300 + 250 + + + True + True + True + True + transaction_sum + False + False + False + 0 + + + + + + column + + + 0 + 600 + + + 0 + + + + + + + column + + + + 1 + + + + + + + + + True + True + 1 + + + + + True + False + label + + + False + True + 2 + + + + + True + False + 7 + 7 + 9 + 7 + True + end + + + gtk-cancel + True + True + True + True + + + + False + True + 0 + + + + + gtk-ok + True + True + True + True + + + + False + True + 1 + + + + + False + True + 3 + + + + + 250 60 @@ -898,6 +915,10 @@ + + + + diff --git a/gui/updater.glade b/gui/updater.glade index 8f65d8c..8ccf556 100644 --- a/gui/updater.glade +++ b/gui/updater.glade @@ -13,7 +13,45 @@ True True vertical - 2 + 4 + + + True + False + 7 + 7 + 10 + + + True + False + /usr/share/pamac/icons/48x48/status/package-update.png + + + False + True + 0 + + + + + True + False + label + + + False + True + 1 + + + + + False + True + 0 + + True @@ -77,48 +115,10 @@ 0 - - - True - False - 7 - 7 - 10 - - - True - False - /usr/share/pamac/icons/48x48/status/package-update.png - - - False - True - 0 - - - - - True - False - label - - - False - True - 1 - - - - - False - True - 1 - - 400 - 450 + 400 True False True @@ -167,17 +167,21 @@ 2 + + + True + False + label + + + False + True + 3 + + - - - - - - - - @@ -186,4 +190,12 @@ + + + + + + + + diff --git a/pamac/main.py b/pamac/main.py index f32bee4..0c754fd 100644 --- a/pamac/main.py +++ b/pamac/main.py @@ -51,7 +51,8 @@ ProgressCancelButton = interface.get_object('ProgressCancelButton') interface.add_from_file('/usr/share/pamac/gui/updater.glade') UpdaterWindow = interface.get_object("UpdaterWindow") update_listore = interface.get_object('update_list') -update_label = interface.get_object('update_label') +update_top_label = interface.get_object('update_top_label') +update_bottom_label = interface.get_object('update_bottom_label') def action_signal_handler(action): if action: @@ -79,9 +80,6 @@ bus.add_signal_receiver(icon_signal_handler, dbus_interface = "org.manjaro.pamac bus.add_signal_receiver(target_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitTarget") bus.add_signal_receiver(percent_signal_handler, dbus_interface = "org.manjaro.pamac", signal_name = "EmitPercent") -installed_column.set_sort_column_id(1) -name_column.set_sort_column_id(0) - installed_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/22x22/status/package-installed.png') uninstalled_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/22x22/status/package-available.png') to_install_icon = Pixbuf.new_from_file('/usr/share/pamac/icons/22x22/status/package-add.png') @@ -101,6 +99,7 @@ for state in states: state_list.append([state]) def get_groups(): + groups_list.clear() tmp_list = [] for repo in transaction.handle.get_syncdbs(): for name, pkgs in repo.grpcache: @@ -111,6 +110,7 @@ def get_groups(): groups_list.append([name]) def get_repos(): + repos_list.clear() for repo in transaction.handle.get_syncdbs(): repos_list.append([repo.name]) repos_list.append(['local']) @@ -276,33 +276,32 @@ def set_list_dict_repos(repo): def refresh_packages_list(): packages_list.clear() if not pkg_name_list: - packages_list.append(["No package found", False, False, False, search_icon]) + packages_list.append(["No package found", False, False, False, search_icon, '', 0]) else: for name in pkg_name_list: if name in config.holdpkg: - packages_list.append([name, True, False, True, locked_icon]) + packages_list.append([name, True, False, True, locked_icon, '', 0]) elif transaction_type is "install": - if pkg_installed_dict[name] is True: - packages_list.append([name, True, False, True, installed_icon]) + if transaction.localpkgs.__contains__(name): + packages_list.append([name, True, False, True, installed_icon, common.format_size(transaction.localpkgs[name].isize), transaction.localpkgs[name].isize]) elif name in transaction_dict.keys(): - packages_list.append([name, False, True, True, to_install_icon]) + packages_list.append([name, False, True, True, to_install_icon, common.format_size(transaction.syncpkgs[name].size), transaction.syncpkgs[name].size]) else: - packages_list.append([name, False, True, False, uninstalled_icon]) + packages_list.append([name, False, True, False, uninstalled_icon, common.format_size(transaction.syncpkgs[name].size), transaction.syncpkgs[name].size]) elif transaction_type is "remove": - if pkg_installed_dict[name] is False: - packages_list.append([name, False, False, False, uninstalled_icon]) + if not transaction.localpkgs.__contains__(name): + packages_list.append([name, False, False, False, uninstalled_icon, common.format_size(transaction.syncpkgs[name].size), transaction.syncpkgs[name].size]) elif name in transaction_dict.keys(): - packages_list.append([name, True, True, False, to_remove_icon]) + packages_list.append([name, True, True, False, to_remove_icon, common.format_size(transaction.localpkgs[name].isize), transaction.localpkgs[name].isize]) else: - packages_list.append([name, True, True, True, installed_icon]) - elif pkg_installed_dict[name] is True: - packages_list.append([name, True, True, True, installed_icon]) + packages_list.append([name, True, True, True, installed_icon, common.format_size(transaction.localpkgs[name].isize), transaction.localpkgs[name].isize]) + elif transaction.localpkgs.__contains__(name): + packages_list.append([name, True, True, True, installed_icon, common.format_size(transaction.localpkgs[name].isize), transaction.localpkgs[name].isize]) else: - packages_list.append([name, False, True, False, uninstalled_icon]) + packages_list.append([name, False, True, False, uninstalled_icon, common.format_size(transaction.syncpkgs[name].size), transaction.syncpkgs[name].size]) def set_packages_list(): if current_filter[0] == 'search': - print(current_filter[1]) set_list_dict_search(*current_filter[1]) if current_filter[0] == 'group': set_list_dict_group(current_filter[1]) @@ -412,8 +411,10 @@ def set_transaction_sum(): while i < len(transaction.to_update): transaction_sum.append([' ', transaction.to_update[i]]) i += 1 - sum_bottom_label.set_markup('') - #sum_bottom_label.set_markup('Total Download size: '+common.format_size(totaldlcb)) + dsize = 0 + for name in transaction.to_add: + dsize += transaction.syncpkgs[name].download_size + sum_bottom_label.set_markup('Total Download size: '+common.format_size(dsize)) sum_top_label.set_markup('Transaction Summary') def handle_error(error): @@ -493,16 +494,20 @@ def do_refresh(): def have_updates(): do_syncfirst, updates = transaction.get_updates() update_listore.clear() - update_label.set_justify(Gtk.Justification.CENTER) + update_top_label.set_justify(Gtk.Justification.CENTER) if not updates: - update_listore.append(["", ""]) - update_label.set_markup("No update available") + update_listore.append(['', '']) + update_bottom_label.set_markup('') + update_top_label.set_markup('No update available') return False else: + dsize = 0 for pkg in updates: pkgname = pkg.name+" "+pkg.version update_listore.append([pkgname, common.format_size(pkg.size)]) - update_label.set_markup("Available updates") + dsize += pkg.download_size + update_bottom_label.set_markup('Total Download size: '+common.format_size(dsize)) + update_top_label.set_markup('Available updates') return True def do_sysupgrade(): @@ -907,12 +912,6 @@ class Handler: current_filter = ('repo', repos_list[line][0]) set_packages_list() - def on_installed_column_clicked(self, widget): - installed_column.set_sort_column_id(1) - - def on_name_column_clicked(self, widget): - name_column.set_sort_column_id(0) - def on_cellrenderertoggle1_toggled(self, widget, line): global transaction_type global transaction_dict @@ -1013,7 +1012,8 @@ def main(_mode): if mode == 'manager': ManagerWindow.show_all() if mode == 'updater': - update_label.set_markup("Available updates") + update_top_label.set_markup('Available updates') + update_bottom_label.set_markup('') UpdaterWindow.show_all() while Gtk.events_pending(): Gtk.main_iteration() diff --git a/setup.py b/setup.py index 4e39b36..23efb49 100644 --- a/setup.py +++ b/setup.py @@ -3,11 +3,11 @@ from distutils.core import setup setup(name='Pamac', - version='0.3', + version='0.5', description='A gtk3 frontend for pyalpm', license='GPL', author='Guillaume Benoit', author_email='guillaume@manjaro.org', - url='https://git.manjaro.org/core/pamac', + url='http://git.manjaro.org/core/pamac', packages=['pamac'], )