tabs in package infos

This commit is contained in:
guinux 2013-03-28 14:59:23 +01:00
parent e6d824c172
commit 831af0a5ca
3 changed files with 339 additions and 98 deletions

View File

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 3.0 --> <!-- interface-requires gtk+ 3.0 -->
<object class="GtkListStore" id="files_list">
<columns>
<!-- column-name file -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="ManagerWindow"> <object class="GtkWindow" id="ManagerWindow">
<property name="width_request">800</property> <property name="width_request">800</property>
<property name="height_request">500</property> <property name="height_request">500</property>
@ -55,7 +61,6 @@
<object class="GtkScrolledWindow" id="scrolledwindow3"> <object class="GtkScrolledWindow" id="scrolledwindow3">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child> <child>
<object class="GtkTreeView" id="search_treeview"> <object class="GtkTreeView" id="search_treeview">
<property name="visible">True</property> <property name="visible">True</property>
@ -107,7 +112,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow1"> <object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property> <property name="margin_top">2</property>
<child> <child>
<object class="GtkTreeView" id="groups_treeview"> <object class="GtkTreeView" id="groups_treeview">
<property name="visible">True</property> <property name="visible">True</property>
@ -155,7 +160,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow2"> <object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property> <property name="margin_top">2</property>
<child> <child>
<object class="GtkTreeView" id="state_treeview"> <object class="GtkTreeView" id="state_treeview">
<property name="visible">True</property> <property name="visible">True</property>
@ -204,7 +209,7 @@
<object class="GtkScrolledWindow" id="scrolledwindow8"> <object class="GtkScrolledWindow" id="scrolledwindow8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property> <property name="margin_top">2</property>
<child> <child>
<object class="GtkTreeView" id="repos_treeview"> <object class="GtkTreeView" id="repos_treeview">
<property name="visible">True</property> <property name="visible">True</property>
@ -270,6 +275,7 @@
<child> <child>
<object class="GtkTreeView" id="list_treeview"> <object class="GtkTreeView" id="list_treeview">
<property name="width_request">500</property> <property name="width_request">500</property>
<property name="height_request">300</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property> <property name="hexpand">True</property>
@ -355,28 +361,176 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow7"> <object class="GtkNotebook" id="notebook2">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child> <child>
<object class="GtkTreeView" id="details_treeview"> <object class="GtkScrolledWindow" id="scrolledwindow10">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="model">package_desc</property> <child>
<object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">8</property>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="name_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">10</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="desc_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">10</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="link_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">10</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="licenses_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="xpad">10</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Infos</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow9">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTreeView" id="deps_treeview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="model">deps_list</property>
<property name="headers_visible">False</property> <property name="headers_visible">False</property>
<property name="headers_clickable">False</property> <property name="headers_clickable">False</property>
<property name="rules_hint">True</property>
<property name="enable_search">False</property> <property name="enable_search">False</property>
<property name="show_expanders">False</property> <property name="show_expanders">False</property>
<child internal-child="selection"> <child internal-child="selection">
<object class="GtkTreeSelection" id="details_treeview_selection"/> <object class="GtkTreeSelection" id="deps_treeview_selection"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="dep_type">
<child>
<object class="GtkCellRendererText" id="cellrenderertext12">
<property name="yalign">0</property>
<property name="weight">600</property>
</object>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn" id="deps">
<child>
<object class="GtkCellRendererText" id="cellrenderertext13"/>
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Deps</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow7">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTreeView" id="details_treeview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="model">details_list</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="search_column">0</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection6"/>
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="infotype"> <object class="GtkTreeViewColumn" id="infotype">
<property name="title" translatable="yes">column</property>
<child> <child>
<object class="GtkCellRendererText" id="cellrenderertext1"> <object class="GtkCellRendererText" id="cellrenderertext1">
<property name="yalign">0</property> <property name="yalign">0</property>
@ -391,7 +545,6 @@
</child> </child>
<child> <child>
<object class="GtkTreeViewColumn" id="type"> <object class="GtkTreeViewColumn" id="type">
<property name="title" translatable="yes">column</property>
<child> <child>
<object class="GtkCellRendererText" id="cellrenderertext4"> <object class="GtkCellRendererText" id="cellrenderertext4">
<property name="wrap_mode">word</property> <property name="wrap_mode">word</property>
@ -405,6 +558,70 @@
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Details</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="files_scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkTreeView" id="files_treeview">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="model">files_list</property>
<property name="headers_visible">False</property>
<property name="headers_clickable">False</property>
<property name="enable_search">False</property>
<property name="show_expanders">False</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection10"/>
</child>
<child>
<object class="GtkTreeViewColumn" id="file_column">
<child>
<object class="GtkCellRendererText" id="cellrenderertext14"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="files_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Files</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="resize">True</property> <property name="resize">True</property>
<property name="shrink">False</property> <property name="shrink">False</property>
@ -885,13 +1102,15 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="groups_list"> <object class="GtkListStore" id="deps_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name dep_type -->
<column type="gchararray"/>
<!-- column-name deps -->
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkListStore" id="package_desc"> <object class="GtkListStore" id="details_list">
<columns> <columns>
<!-- column-name info_type --> <!-- column-name info_type -->
<column type="gchararray"/> <column type="gchararray"/>
@ -905,6 +1124,12 @@
</row> </row>
</data> </data>
</object> </object>
<object class="GtkListStore" id="groups_list">
<columns>
<!-- column-name name -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="packages_list"> <object class="GtkListStore" id="packages_list">
<columns> <columns>
<!-- column-name name --> <!-- column-name name -->

View File

@ -13,9 +13,9 @@ bus = dbus.SystemBus()
icon = '' icon = ''
info = '' info = ''
update_icon = '/usr/share/pamac/icons/scalable/status/update-normal.svg' update_icon = '/usr/share/pamac/icons/scalable/status/update-normal.svg'
update_info = '{} Updates Available' update_info = '{} available updates'
noupdate_icon = '/usr/share/pamac/icons/scalable/status/update-enhancement.svg' noupdate_icon = '/usr/share/pamac/icons/scalable/status/update-enhancement.svg'
noupdate_info = ' No Update Available' noupdate_info = ' No available update'
class Tray: class Tray:
def __init__(self): def __init__(self):

View File

@ -20,8 +20,14 @@ interface = Gtk.Builder()
interface.add_from_file('/usr/share/pamac/gui/manager.glade') interface.add_from_file('/usr/share/pamac/gui/manager.glade')
ManagerWindow = interface.get_object("ManagerWindow") ManagerWindow = interface.get_object("ManagerWindow")
package_desc = interface.get_object('package_desc') details_list = interface.get_object('details_list')
#select_toggle = interface.get_object('cellrenderertoggle1') deps_list = interface.get_object('deps_list')
files_list = interface.get_object('files_list')
files_scrolledwindow = interface.get_object('files_scrolledwindow')
name_label = interface.get_object('name_label')
desc_label = interface.get_object('desc_label')
link_label = interface.get_object('link_label')
licenses_label = interface.get_object('licenses_label')
search_entry = interface.get_object('search_entry') search_entry = interface.get_object('search_entry')
search_list = interface.get_object('search_list') search_list = interface.get_object('search_list')
search_selection = interface.get_object('search_treeview_selection') search_selection = interface.get_object('search_treeview_selection')
@ -57,7 +63,7 @@ update_bottom_label = interface.get_object('update_bottom_label')
def action_signal_handler(action): def action_signal_handler(action):
if action: if action:
progress_label.set_text(action) progress_label.set_text(action)
if ('Installing' in action) or ('Removing' in action) or ('Updating' in action): if ('Installing' in action) or ('Removing' in action) or ('Updating' in action) or ('Configuring' in action):
ProgressCancelButton.set_visible(False) ProgressCancelButton.set_visible(False)
else: else:
ProgressCancelButton.set_visible(True) ProgressCancelButton.set_visible(True)
@ -321,64 +327,70 @@ def set_packages_list():
set_list_dict_repos(current_filter[1]) set_list_dict_repos(current_filter[1])
refresh_packages_list() refresh_packages_list()
def set_desc(pkg, style): def set_infos_list(pkg):
""" name_label.set_markup('<big><b>{} {}</b></big>'.format(pkg.name, pkg.version))
Args : desc_label.set_markup(pkg.desc)
pkg_object -- the package to display link_label.set_markup('<a href=\"{url}\" title=\"{url}\">{url}</a>'.format(url = pkg.url))
style -- 'local' or 'sync' licenses_label.set_markup('Licenses: {}'.format(' '.join(pkg.licenses)))
"""
if style not in ['local', 'sync', 'file']: def set_deps_list(pkg, style):
raise ValueError('Invalid style for package info formatting') deps_list.clear()
if pkg.depends:
package_desc.clear() deps_list.append(['Depends On:', '\n'.join(pkg.depends)])
if pkg.optdepends:
deps_list.append(['Optional Deps:', '\n'.join(pkg.optdepends)])
if style == 'local':
if pkg.compute_requiredby():
deps_list.append(['Required By:', '\n'.join(pkg.compute_requiredby())])
if pkg.provides:
details_list.append(['Provides:', ' '.join(pkg.provides)])
if pkg.replaces:
details_list.append(['Replaces:', ' '.join(pkg.replaces)])
if pkg.conflicts:
details_list.append(['Conflicts With:', ' '.join(pkg.conflicts)])
def set_details_list(pkg, style):
details_list.clear()
if style == 'sync': if style == 'sync':
package_desc.append(['Repository:', pkg.db.name]) details_list.append(['Repository:', pkg.db.name])
package_desc.append(['Name:', pkg.name]) if pkg.groups:
package_desc.append(['Version:', pkg.version]) details_list.append(['Groups:', ' '.join(pkg.groups)])
package_desc.append(['Description:', pkg.desc])
package_desc.append(['URL:', pkg.url])
package_desc.append(['Licenses:', ' '.join(pkg.licenses)])
package_desc.append(['Groups:', ' '.join(pkg.groups)])
package_desc.append(['Provides:', ' '.join(pkg.provides)])
package_desc.append(['Depends On:', ' '.join(pkg.depends)])
package_desc.append(['Optional Deps:', '\n'.join(pkg.optdepends)])
if style == 'local':
package_desc.append(['Required By:', ' '.join(pkg.compute_requiredby())])
package_desc.append(['Conflicts With:', ' '.join(pkg.conflicts)])
package_desc.append(['Replaces:', ' '.join(pkg.replaces)])
if style == 'sync': if style == 'sync':
package_desc.append(['Compressed Size:', common.format_size(pkg.size)]) details_list.append(['Compressed Size:', common.format_size(pkg.size)])
package_desc.append(['Download Size:', common.format_size(pkg.download_size)]) details_list.append(['Download Size:', common.format_size(pkg.download_size)])
if style == 'local': if style == 'local':
package_desc.append(['Installed Size:', common.format_size(pkg.isize)]) details_list.append(['Installed Size:', common.format_size(pkg.isize)])
package_desc.append(['Packager:', pkg.packager]) details_list.append(['Packager:', pkg.packager])
package_desc.append(['Architecture:', pkg.arch]) details_list.append(['Architecture:', pkg.arch])
#package_desc.append(['Build Date:', strftime("%a %d %b %Y %X %Z", localtime(pkg.builddate))]) #details_list.append(['Build Date:', strftime("%a %d %b %Y %X %Z", localtime(pkg.builddate))])
if style == 'local': if style == 'local':
#package_desc.append(['Install Date:', strftime("%a %d %b %Y %X %Z", localtime(pkg.installdate))]) details_list.append(['Install Date:', strftime("%a %d %b %Y %X %Z", localtime(pkg.installdate))])
if pkg.reason == pyalpm.PKG_REASON_EXPLICIT: if pkg.reason == pyalpm.PKG_REASON_EXPLICIT:
reason = 'Explicitly installed' reason = 'Explicitly installed'
elif pkg.reason == pyalpm.PKG_REASON_DEPEND: elif pkg.reason == pyalpm.PKG_REASON_DEPEND:
reason = 'Installed as a dependency for another package' reason = 'Installed as a dependency for another package'
else: else:
reason = 'N/A' reason = 'N/A'
package_desc.append(['Install Reason:', reason]) details_list.append(['Install Reason:', reason])
if style == 'sync': if style == 'sync':
#package_desc.append(['Install Script:', 'Yes' if pkg.has_scriptlet else 'No']) #details_list.append(['Install Script:', 'Yes' if pkg.has_scriptlet else 'No'])
#package_desc.append(['MD5 Sum:', pkg.md5sum]) #details_list.append(['MD5 Sum:', pkg.md5sum])
#package_desc.append(['SHA256 Sum:', pkg.sha256sum]) #details_list.append(['SHA256 Sum:', pkg.sha256sum])
package_desc.append(['Signatures:', 'Yes' if pkg.base64_sig else 'No']) details_list.append(['Signatures:', 'Yes' if pkg.base64_sig else 'No'])
if style == 'local': if style == 'local':
if len(pkg.backup) == 0: if len(pkg.backup) != 0:
package_desc.append(['Backup files:', '']) #details_list.append(['Backup files:', '\n'.join(["%s %s" % (md5, file) for (file, md5) in pkg.backup])])
else: details_list.append(['Backup files:', '\n'.join(["%s" % (file) for (file, md5) in pkg.backup])])
#package_desc.append(['Backup files:', '\n'.join(["%s %s" % (md5, file) for (file, md5) in pkg.backup])])
package_desc.append(['Backup files:', '\n'.join(["%s" % (file) for (file, md5) in pkg.backup])]) def set_files_list(pkg):
files_list.clear()
if len(pkg.files) != 0:
for file in pkg.files:
files_list.append(['/'+file[0]])
def set_transaction_sum(): def set_transaction_sum():
transaction_sum.clear() transaction_sum.clear()
sum_top_label.set_markup('<big><b>Transaction Summary</b></big>')
if transaction.to_remove: if transaction.to_remove:
transaction.to_remove = sorted(transaction.to_remove) transaction.to_remove = sorted(transaction.to_remove)
transaction_sum.append(['To remove:', transaction.to_remove[0]]) transaction_sum.append(['To remove:', transaction.to_remove[0]])
@ -389,6 +401,10 @@ def set_transaction_sum():
sum_bottom_label.set_markup('') sum_bottom_label.set_markup('')
if transaction.to_add: if transaction.to_add:
transaction.to_add = sorted(transaction.to_add) transaction.to_add = sorted(transaction.to_add)
dsize = 0
for name in transaction.to_add:
dsize += transaction.syncpkgs[name].download_size
sum_bottom_label.set_markup('<b>Total download size: </b>'+common.format_size(dsize))
installed = [] installed = []
for pkg_object in config.pacman_conf.initialize_alpm().get_localdb().pkgcache: for pkg_object in config.pacman_conf.initialize_alpm().get_localdb().pkgcache:
installed.append(pkg_object.name) installed.append(pkg_object.name)
@ -409,11 +425,6 @@ def set_transaction_sum():
while i < len(transaction.to_update): while i < len(transaction.to_update):
transaction_sum.append([' ', transaction.to_update[i]]) transaction_sum.append([' ', transaction.to_update[i]])
i += 1 i += 1
dsize = 0
for name in transaction.to_add:
dsize += transaction.syncpkgs[name].download_size
sum_bottom_label.set_markup('<b>Total Download size: </b>'+common.format_size(dsize))
sum_top_label.set_markup('<big><b>Transaction Summary</b></big>')
def handle_error(error): def handle_error(error):
global transaction_type global transaction_type
@ -494,7 +505,7 @@ def have_updates():
if not updates: if not updates:
update_listore.append(['', '']) update_listore.append(['', ''])
update_bottom_label.set_markup('') update_bottom_label.set_markup('')
update_top_label.set_markup('<big><b>No update available</b></big>') update_top_label.set_markup('<big><b>No available update </b></big>')
return False return False
else: else:
dsize = 0 dsize = 0
@ -502,8 +513,8 @@ def have_updates():
pkgname = pkg.name+" "+pkg.version pkgname = pkg.name+" "+pkg.version
update_listore.append([pkgname, common.format_size(pkg.size)]) update_listore.append([pkgname, common.format_size(pkg.size)])
dsize += pkg.download_size dsize += pkg.download_size
update_bottom_label.set_markup('<b>Total Download size: </b>'+common.format_size(dsize)) update_bottom_label.set_markup('<b>Total download size: </b>'+common.format_size(dsize))
update_top_label.set_markup('<big><b>Available updates</b></big>') update_top_label.set_markup('<big><b>{} available updates</b></big>'.format(len(updates)))
return True return True
def do_sysupgrade(): def do_sysupgrade():
@ -864,9 +875,14 @@ class Handler:
pkg_object = pkg_object_dict[packages_list[line][0]] pkg_object = pkg_object_dict[packages_list[line][0]]
if pkg_installed_dict[packages_list[line][0]] is True: if pkg_installed_dict[packages_list[line][0]] is True:
style = "local" style = "local"
set_files_list(pkg_object)
files_scrolledwindow.set_visible(True)
else: else:
style = "sync" style = "sync"
set_desc(pkg_object, style) files_scrolledwindow.set_visible(False)
set_infos_list(pkg_object)
set_deps_list(pkg_object, style)
set_details_list(pkg_object, style)
def on_search_treeview_selection_changed(self, widget): def on_search_treeview_selection_changed(self, widget):
global current_filter global current_filter