New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional source column to the main overview - Issue #77 #184

Merged
merged 1 commit into from Oct 25, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+27 −7
Diff settings

Always

Just for now

@@ -55,6 +55,7 @@
update_type = "package"
update_origin = "linuxmint"
for origin in pkg.candidate.origins:
update_site = origin.site
if origin.origin == "Ubuntu":
update_origin = "ubuntu"
elif origin.origin == "Debian":
@@ -74,7 +75,7 @@
else:
update_type = "linuxmint"

resultString = u"UPDATE###%s###%s###%s###%s###%s###%s###%s###%s###%s---EOL---" % (package, newVersion, oldVersion, size, sourcePackage, update_type, update_origin, short_description, description)
resultString = u"UPDATE###%s###%s###%s###%s###%s###%s###%s###%s###%s###%s---EOL---" % (package, newVersion, oldVersion, size, sourcePackage, update_type, update_origin, short_description, description, update_site)
print(resultString.encode('ascii', 'xmlcharrefreplace'))

if kernel_updates:
@@ -49,7 +49,7 @@
package_short_descriptions = {}
package_descriptions = {}

(UPDATE_CHECKED, UPDATE_ALIAS, UPDATE_LEVEL_PIX, UPDATE_OLD_VERSION, UPDATE_NEW_VERSION, UPDATE_LEVEL_STR, UPDATE_SIZE, UPDATE_SIZE_STR, UPDATE_TYPE_PIX, UPDATE_TYPE, UPDATE_TOOLTIP, UPDATE_SORT_STR, UPDATE_OBJ) = range(13)
(UPDATE_CHECKED, UPDATE_ALIAS, UPDATE_LEVEL_PIX, UPDATE_OLD_VERSION, UPDATE_NEW_VERSION, UPDATE_SOURCE, UPDATE_LEVEL_STR, UPDATE_SIZE, UPDATE_SIZE_STR, UPDATE_TYPE_PIX, UPDATE_TYPE, UPDATE_TOOLTIP, UPDATE_SORT_STR, UPDATE_OBJ) = range(14)

def size_to_string(size):
strSize = str(size) + _("B")
@@ -80,7 +80,7 @@ def __init__(self, name, short_description, description):
self.description = description

class PackageUpdate():
def __init__(self, source_package_name, level, oldVersion, newVersion, extraInfo, warning, update_type, origin, tooltip):
def __init__(self, source_package_name, level, oldVersion, newVersion, extraInfo, warning, update_type, origin, site, tooltip):
self.name = source_package_name
self.description = ""
self.short_description = ""
@@ -93,6 +93,7 @@ def __init__(self, source_package_name, level, oldVersion, newVersion, extraInfo
self.warning = warning
self.type = update_type
self.origin = origin
self.site = site
self.tooltip = tooltip
self.packages = []
self.alias = source_package_name
@@ -718,8 +719,8 @@ def run(self):
self.application.builder.get_object("paned1").set_position(vpaned_position)
Gdk.threads_leave()

model = Gtk.TreeStore(str, str, GdkPixbuf.Pixbuf, str, str, str, int, str, str, str, str, str, object)
# UPDATE_CHECKED, UPDATE_ALIAS, UPDATE_LEVEL_PIX, UPDATE_OLD_VERSION, UPDATE_NEW_VERSION, UPDATE_LEVEL_STR,
model = Gtk.TreeStore(str, str, GdkPixbuf.Pixbuf, str, str, str, str, int, str, str, str, str, str, object)
# UPDATE_CHECKED, UPDATE_ALIAS, UPDATE_LEVEL_PIX, UPDATE_OLD_VERSION, UPDATE_NEW_VERSION, UPDATE_SOURCE, UPDATE_LEVEL_STR,
# UPDATE_SIZE, UPDATE_SIZE_STR, UPDATE_TYPE_PIX, UPDATE_TYPE, UPDATE_TOOLTIP, UPDATE_SORT_STR, UPDATE_OBJ

model.set_sort_column_id( UPDATE_SORT_STR, Gtk.SortType.ASCENDING )
@@ -839,7 +840,7 @@ def run(self):

values = pkg.split("###")

if len(values) == 10:
if len(values) == 11:
status = values[0]
package = values[1]
newVersion = values[2]
@@ -850,6 +851,7 @@ def run(self):
origin = values[7]
short_description = values[8]
description = values[9]
site = values[10]

package_names.add(package.replace(":i386", "").replace(":amd64", ""))

@@ -923,7 +925,7 @@ def run(self):
level = int(level)

# Create a new Update
update = PackageUpdate(source_package, level, oldVersion, newVersion, extraInfo, warning, update_type, origin, tooltip)
update = PackageUpdate(source_package, level, oldVersion, newVersion, extraInfo, warning, update_type, origin, site, tooltip)
update.add_package(package, size, short_description, description)
package_updates[source_package] = update
else:
@@ -990,6 +992,7 @@ def run(self):
model.set_value(iter, UPDATE_LEVEL_PIX, pixbuf)
model.set_value(iter, UPDATE_OLD_VERSION, package_update.oldVersion)
model.set_value(iter, UPDATE_NEW_VERSION, package_update.newVersion)
model.set_value(iter, UPDATE_SOURCE, "%s (%s)" % (package_update.origin, package_update.site))
model.set_value(iter, UPDATE_LEVEL_STR, str(package_update.level))
model.set_value(iter, UPDATE_SIZE, package_update.size)
model.set_value(iter, UPDATE_SIZE_STR, size_to_string(package_update.size))
@@ -1316,6 +1319,10 @@ def __init__(self):
column7.set_sort_column_id(UPDATE_TYPE)
column7.set_resizable(True)

column8 = Gtk.TreeViewColumn(_("Source"), Gtk.CellRendererText(), text=UPDATE_SOURCE)
column8.set_sort_column_id(UPDATE_SOURCE)
column8.set_resizable(True)

self.treeview.set_tooltip_column(UPDATE_TOOLTIP)

self.treeview.append_column(column7)
@@ -1324,6 +1331,7 @@ def __init__(self):
self.treeview.append_column(column2)
self.treeview.append_column(column4)
self.treeview.append_column(column5)
self.treeview.append_column(column8)
self.treeview.append_column(column6)

self.treeview.set_headers_clickable(True)
@@ -1505,6 +1513,12 @@ def __init__(self):
sizeColumnMenuItem.connect("toggled", self.setVisibleColumn, column6, "show-size-column")
visibleColumnsMenu.append(sizeColumnMenuItem)

sizeColumnMenuItem = Gtk.CheckMenuItem(_("Source"))
sizeColumnMenuItem.set_active(self.settings.get_boolean("show-source-column"))
column8.set_visible(self.settings.get_boolean("show-source-column"))
sizeColumnMenuItem.connect("toggled", self.setVisibleColumn, column8, "show-source-column")
visibleColumnsMenu.append(sizeColumnMenuItem)

viewSubmenu.append(visibleColumnsMenuItem)

descriptionsMenuItem = Gtk.CheckMenuItem(_("Show descriptions"))
@@ -161,6 +161,11 @@
<summary></summary>
<description></description>
</key>
<key type="b" name="show-source-column">
<default>false</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="show-descriptions">
<default>true</default>
<summary></summary>
ProTip! Use n and p to navigate between commits in a pull request.