From 9de60cec326a98763ece1ea87218cd5c9086e0de Mon Sep 17 00:00:00 2001 From: Rene Lopez Date: Tue, 4 Aug 2009 11:57:16 -0500 Subject: [PATCH] Replaced Glade with GtkBuilder Fixed UI resources stating that some top level widgets were visible. Fixed the error when selecting a preferred stability it will be switched to the one above the selected one. --- Makefile | 8 +- setup.py | 6 +- zeroinstall/0launch-gui/dialog.py | 5 +- zeroinstall/0launch-gui/preferences.py | 8 - zeroinstall/0launch-gui/properties.py | 10 +- zeroinstall/0launch-gui/zero-install.glade | 1330 ---------------------------- zeroinstall/0launch-gui/zero-install.ui | 921 +++++++++++++++++++ zeroinstall/gtkui/__init__.py | 3 - zeroinstall/gtkui/addbox.py | 22 +- zeroinstall/gtkui/applistbox.py | 12 +- zeroinstall/gtkui/cache.glade | 114 --- zeroinstall/gtkui/cache.py | 2 +- zeroinstall/gtkui/cache.ui | 93 ++ zeroinstall/gtkui/desktop.glade | 770 ---------------- zeroinstall/gtkui/desktop.ui | 524 +++++++++++ zeroinstall/gtkui/gtkutils.py | 16 +- 16 files changed, 1580 insertions(+), 2264 deletions(-) delete mode 100644 zeroinstall/0launch-gui/zero-install.glade create mode 100644 zeroinstall/0launch-gui/zero-install.ui delete mode 100644 zeroinstall/gtkui/cache.glade create mode 100644 zeroinstall/gtkui/cache.ui delete mode 100644 zeroinstall/gtkui/desktop.glade create mode 100644 zeroinstall/gtkui/desktop.ui diff --git a/Makefile b/Makefile index 992a4ba..18add0d 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PYTHON=python MO = $(shell find locale -name '*.po' | sed -e 's/\.po/\.mo/') PY = $(shell find zeroinstall -name '*.py') -GLADE = $(shell find zeroinstall -name '*.glade' | sed -e 's/\.glade/&.h/') +GTKBUILDER = $(shell find zeroinstall -name '*.ui' | sed -e 's/\.ui/&.h/') SH = zeroinstall/zerostore/_unlzma all: translations @@ -18,11 +18,11 @@ install: all %.mo: %.po msgfmt -o "$@" "$<" -%.glade.h: %.glade +%.ui.h: %.ui intltool-extract --type=gettext/glade --update "$<" -locale/zero-install.pot: $(PY) $(GLADE) $(SH) - xgettext --language=Python --output=$@ --keyword=N_ $(PY) $(GLADE) +locale/zero-install.pot: $(PY) $(GTKBUILDER) $(SH) + xgettext --language=Python --output=$@ --keyword=N_ $(PY) $(GTKBUILDER) xgettext --language=Shell -j --output=$@ $(SH) update-po: locale/zero-install.pot diff --git a/setup.py b/setup.py index 5f6d6d0..da3d64a 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,9 @@ class build_with_data(build_py): "zeroinstall/0launch-gui/README", "zeroinstall/0launch-gui/0launch-gui", "zeroinstall/0launch-gui/ZeroInstall-GUI.xml", - "zeroinstall/0launch-gui/zero-install.glade", - "zeroinstall/gtkui/desktop.glade", - "zeroinstall/gtkui/cache.glade", + "zeroinstall/0launch-gui/zero-install.ui", + "zeroinstall/gtkui/desktop.ui", + "zeroinstall/gtkui/cache.ui", "zeroinstall/zerostore/_unlzma", ] def run(self): diff --git a/zeroinstall/0launch-gui/dialog.py b/zeroinstall/0launch-gui/dialog.py index d443b2e..0d23be3 100644 --- a/zeroinstall/0launch-gui/dialog.py +++ b/zeroinstall/0launch-gui/dialog.py @@ -2,7 +2,6 @@ # See the README file for details, or visit http://0install.net. import gtk -import gtk.glade import os from zeroinstall.support import tasks from zeroinstall.gtkui import gtkutils @@ -11,11 +10,11 @@ n_windows = 0 last_error = None -gladefile = os.path.join(os.path.dirname(__file__), 'zero-install.glade') +builderfile = os.path.join(os.path.dirname(__file__), 'zero-install.ui') class Template(gtkutils.Template): def __init__(self, root): - gtkutils.Template.__init__(self, gladefile, root) + gtkutils.Template.__init__(self, builderfile, root) class Dialog(gtk.Dialog): __shown = False diff --git a/zeroinstall/0launch-gui/preferences.py b/zeroinstall/0launch-gui/preferences.py index 3366a6b..d8c92bd 100644 --- a/zeroinstall/0launch-gui/preferences.py +++ b/zeroinstall/0launch-gui/preferences.py @@ -12,12 +12,6 @@ tips = gtk.Tooltips() SHOW_CACHE = 0 -network_names = { - 'off-line': _('Off-line'), - 'minimal': _('Minimal'), - 'full': _('Full'), -} - class Preferences: def __init__(self, policy): widgets = Template('preferences_box') @@ -26,8 +20,6 @@ class Preferences: self.window.connect('destroy', lambda w: self.destroyed()) network = widgets.get_widget('network_use') - for level in network_levels: - network.append_text(network_names.get(level, level.capitalize())) network.set_active(list(network_levels).index(policy.network_use)) def set_network_use(combo): diff --git a/zeroinstall/0launch-gui/properties.py b/zeroinstall/0launch-gui/properties.py index 9f95084..a4455d7 100644 --- a/zeroinstall/0launch-gui/properties.py +++ b/zeroinstall/0launch-gui/properties.py @@ -286,9 +286,9 @@ class Properties: stability.set_active(0) if interface.stability_policy: i = [stable, testing, developer].index(interface.stability_policy) - if i == -1: + i += 1 + if i == 0: warn(_("Unknown stability policy %s"), interface.stability_policy) - i = 0 else: i = 0 stability.set_active(i) @@ -321,7 +321,10 @@ class Properties: if show_versions: notebook.next_page() - + + def show(self): + self.window.show() + def destroy(self): self.window.destroy() @@ -452,6 +455,7 @@ def edit(policy, interface, show_versions = False): if interface in _dialogs: _dialogs[interface].destroy() _dialogs[interface] = Properties(policy, interface, show_versions) + _dialogs[interface].show() properties_help = help_box.HelpBox(_("Injector Properties Help"), (_('Interface properties'), '\n' + diff --git a/zeroinstall/0launch-gui/zero-install.glade b/zeroinstall/0launch-gui/zero-install.glade deleted file mode 100644 index 01afe2d..0000000 --- a/zeroinstall/0launch-gui/zero-install.glade +++ /dev/null @@ -1,1330 +0,0 @@ - - - - - - - Zero Install - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - gtk-preferences - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 4 - True - False - 0 - - - - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_END - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 4 - True - True - - - - - - True - False - 4 - - - - True - Check all the components for updates. - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-refresh - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Re_fresh all now - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - - False - 0 - - - - True - GTK_PROGRESS_LEFT_TO_RIGHT - 0 - 0.10000000149 - PANGO_ELLIPSIZE_NONE - - - 4 - True - True - - - - - - True - True - gtk-stop - True - GTK_RELIEF_NORMAL - True - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - False - True - - - - - 0 - True - True - - - - - - - - Zero Install Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 8 - True - False - 12 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - False - 2 - - - - True - 2 - 2 - False - 4 - 0 - - - - True - Network use: - False - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - Freshness: - False - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - This controls whether Zero Install will always try to run the best version, downloading it if needed, or whether it will prefer to run an older version that is already on your machine. - True - False - - - - True - - False - True - - - - - 1 - 2 - 0 - 1 - fill - - - - - - True - If you run a program which hasn't been checked for this long, then Zero Install will check for updates (in the background, while the old version is actually run). - True - False - - - - True - - False - True - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - 2 - True - True - - - - - - True - Try out new versions as soon as they are available, instead of waiting for them to be marked as 'stable'. This sets the default policy. Click on 'Interface Properties...' to set the policy for an individual interface. - True - Help test new versions - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - - - - - - True - <b>Policy settings</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - True - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - False - 0 - - - - True - <i>You have said that you trust these keys to sign software updates:</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 4 - False - False - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - - - - - True - <b>Security</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - True - Interface properties - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - GTK_RELIEF_NORMAL - True - 0 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-convert - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Compile - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -6 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - True - True - True - GTK_POS_TOP - False - False - - - - True - True - 0 - - - - True - False - 0 - - - - 4 - True - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - - 4 - True - False - 0 - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Add remote feed - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - - True - If you have another implementation of this interface (e.g. a CVS checkout), you can add it to the list by registering the XML feed file that came with it. - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Add local feed - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Remove feed - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - 0 - False - True - - - - - False - False - - - - - - 4 - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - False - 0 - 0 - 0 - 4 - 4 - 0 - - - - - - True - True - - - - - False - True - - - - - - True - Feeds - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - 4 - True - False - 4 - - - - True - False - 0 - - - - True - Preferred stability: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - Implementations at this stability level or higher will be used in preference to others. You can use this to override the global "Help test new versions" setting just for this interface. - True - False - - - - True - Use default setting -Stable -Testing -Developer - False - True - - - - - 0 - False - True - - - - - 0 - False - True - - - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - 0 - True - True - - - - - False - True - - - - - - True - Versions - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - 0 - True - True - - - - - - - diff --git a/zeroinstall/0launch-gui/zero-install.ui b/zeroinstall/0launch-gui/zero-install.ui new file mode 100644 index 0000000..2e57d42 --- /dev/null +++ b/zeroinstall/0launch-gui/zero-install.ui @@ -0,0 +1,921 @@ + + + + + + + + + + + + Use default setting + + + Stable + + + Testing + + + Developer + + + + + + + + + + + Off-line + + + Minimal + + + Full + + + + + + + + + + + Zero Install + dialog + False + + + True + + + True + 4 + + + 0 + end + + + False + False + 0 + + + + + True + True + automatic + in + + + True + True + + + + + 4 + 1 + + + + + True + 4 + + + True + True + False + Check all the components for updates. + + + True + 0 + 0 + + + True + 2 + + + True + gtk-refresh + + + False + False + 0 + + + + + True + Re_fresh all now + True + + + False + False + 1 + + + + + + + + + False + False + 0 + + + + + + + True + 0.10000000149 + + + 4 + 0 + + + + + gtk-stop + True + True + False + True + + + False + False + 1 + + + + + 1 + + + + + False + 2 + + + + + 1 + + + + + True + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + gtk-preferences + True + True + True + False + True + + + False + False + 1 + + + + + gtk-cancel + True + True + True + False + True + + + False + False + 2 + + + + + False + end + 0 + + + + + + helpbutton1 + preferences + button2 + + + + Zero Install Preferences + dialog + False + + + True + + + True + 8 + 12 + + + True + 0 + none + + + True + 12 + + + True + 2 + + + True + 2 + 2 + 4 + + + True + 1 + Network use: + + + GTK_FILL + + + + + + True + 1 + Freshness: + + + 1 + 2 + GTK_FILL + + + + + + True + This controls whether Zero Install will always try to run the best version, downloading it if needed, or whether it will prefer to run an older version that is already on your machine. + + + True + liststore2 + + + + 0 + + + + + + + 1 + 2 + GTK_FILL + + + + + True + If you run a program which hasn't been checked for this long, then Zero Install will check for updates (in the background, while the old version is actually run). + + + True + liststore3 + + + + 0 + + + + + + + 1 + 2 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + 2 + 0 + + + + + Help test new versions + True + True + False + Try out new versions as soon as they are available, instead of waiting for them to be marked as 'stable'. This sets the default policy. Click on 'Interface Properties...' to set the policy for an individual interface. + True + True + + + False + False + 1 + + + + + + + + + True + Policy settings + + + + + + + + False + 0 + + + + + True + 0 + none + + + True + 12 + + + True + + + True + 0 + You have said that you trust these keys to sign software updates: + + + + + + False + False + 4 + 0 + + + + + True + True + never + in + + + True + True + + + + + 1 + + + + + + + + + True + Security + + + + + + + + 1 + + + + + 1 + + + + + True + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + gtk-close + True + True + True + False + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + helpbutton2 + closebutton1 + + + + Interface properties + dialog + + + True + + + True + True + + + True + True + + + True + + + True + True + 4 + never + in + + + True + True + + + + + 0 + + + + + True + 4 + + + True + True + False + + + True + 0 + 0 + + + True + 2 + + + True + gtk-add + + + False + False + 0 + + + + + True + Add remote feed + True + + + False + False + 1 + + + + + + + + + False + False + 0 + + + + + True + True + False + If you have another implementation of this interface (e.g. a CVS checkout), you can add it to the list by registering the XML feed file that came with it. + + + True + 0 + 0 + + + True + 2 + + + True + gtk-add + + + False + False + 0 + + + + + True + Add local feed + True + + + False + False + 1 + + + + + + + + + False + False + 1 + + + + + True + True + False + + + True + 0 + 0 + + + True + 2 + + + True + gtk-remove + + + False + False + 0 + + + + + True + Remove feed + True + + + False + False + 1 + + + + + + + + + False + False + 2 + + + + + False + 1 + + + + + False + False + + + + + True + True + 4 + automatic + in + + + True + True + False + word + 4 + 4 + False + + + + + True + True + + + + + + + True + Feeds + + + False + + + + + True + 4 + 4 + + + True + + + True + Preferred stability: + + + False + False + 0 + + + + + True + Implementations at this stability level or higher will be used in preference to others. You can use this to override the global "Help test new versions" setting just for this interface. + + + True + liststore1 + + + + 0 + + + + + + + False + 1 + + + + + False + 0 + + + + + True + True + never + in + + + True + True + + + + + 1 + + + + + 1 + + + + + True + Versions + + + 1 + False + + + + + 2 + + + + + True + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + True + True + True + False + + + True + 0 + 0 + + + True + 2 + + + True + gtk-convert + + + False + False + 0 + + + + + True + Compile + True + + + False + False + 1 + + + + + + + + + False + False + 1 + + + + + gtk-close + True + True + True + False + True + + + False + False + 2 + + + + + False + end + 0 + + + + + + helpbutton3 + compile + button9 + + + diff --git a/zeroinstall/gtkui/__init__.py b/zeroinstall/gtkui/__init__.py index 0948aa8..bc7b195 100644 --- a/zeroinstall/gtkui/__init__.py +++ b/zeroinstall/gtkui/__init__.py @@ -1,4 +1 @@ """GTK user interface.""" - -from gtk import glade -glade.textdomain('zero-install') diff --git a/zeroinstall/gtkui/addbox.py b/zeroinstall/gtkui/addbox.py index 68d1452..5757dec 100644 --- a/zeroinstall/gtkui/addbox.py +++ b/zeroinstall/gtkui/addbox.py @@ -6,7 +6,6 @@ from zeroinstall import _ import os, sys import gtk, gobject -import gtk.glade from zeroinstall import SafeException from zeroinstall.injector import model @@ -22,22 +21,23 @@ _RESPONSE_NEXT = 1 class AddBox: """A dialog box which prompts the user to choose the program to be added.""" def __init__(self, interface_uri = None): - gladefile = os.path.join(os.path.dirname(__file__), 'desktop.glade') + builderfile = os.path.join(os.path.dirname(__file__), 'desktop.ui') - widgets = gtk.glade.XML(gladefile, 'main') - self.window = widgets.get_widget('main') + builder = gtk.Builder() + builder.add_from_file(builderfile) + self.window = builder.get_object('main') self.set_keep_above(True) def set_uri_ok(uri): text = uri.get_text() self.window.set_response_sensitive(_RESPONSE_NEXT, bool(text)) - uri = widgets.get_widget('interface_uri') - about = widgets.get_widget('about') - icon_widget = widgets.get_widget('icon') - category = widgets.get_widget('category') - dialog_next = widgets.get_widget('dialog_next') - dialog_ok = widgets.get_widget('dialog_ok') + uri = builder.get_object('interface_uri') + about = builder.get_object('about') + icon_widget = builder.get_object('icon') + category = builder.get_object('category') + dialog_next = builder.get_object('dialog_next') + dialog_ok = builder.get_object('dialog_ok') if interface_uri: uri.set_text(interface_uri) @@ -65,7 +65,7 @@ class AddBox: gtk.gdk.ACTION_COPY) self.window.connect('drag-data-received', uri_dropped) - nb = widgets.get_widget('notebook1') + nb = builder.get_object('notebook1') def update_details_page(): iface = iface_cache.get_interface(model.canonical_iface_uri(uri.get_text())) diff --git a/zeroinstall/gtkui/applistbox.py b/zeroinstall/gtkui/applistbox.py index 408bc1c..3c99890 100644 --- a/zeroinstall/gtkui/applistbox.py +++ b/zeroinstall/gtkui/applistbox.py @@ -5,7 +5,6 @@ from zeroinstall import _ import os import gtk, gobject, pango -import gtk.glade import subprocess from zeroinstall.gtkui import icon, xdgutils, treetips @@ -46,13 +45,14 @@ class AppListBox: @param app_list: used to list or remove applications @type app_list: L{AppList} """ - gladefile = os.path.join(os.path.dirname(__file__), 'desktop.glade') + builderfile = os.path.join(os.path.dirname(__file__), 'desktop.ui') self.iface_cache = iface_cache self.app_list = app_list - widgets = gtk.glade.XML(gladefile, 'applist') - self.window = widgets.get_widget('applist') - tv = widgets.get_widget('treeview') + builder = gtk.Builder() + builder.add_from_file(builderfile) + self.window = builder.get_object('applist') + tv = builder.get_object('treeview') self.model = gtk.ListStore(gtk.gdk.Pixbuf, str, str, str) @@ -110,7 +110,7 @@ class AppListBox: self.model.set_sort_column_id(AppListBox.NAME, gtk.SORT_ASCENDING) - show_cache = widgets.get_widget('show_cache') + show_cache = builder.get_object('show_cache') self.window.action_area.set_child_secondary(show_cache, True) def response(box, resp): diff --git a/zeroinstall/gtkui/cache.glade b/zeroinstall/gtkui/cache.glade deleted file mode 100644 index d175948..0000000 --- a/zeroinstall/gtkui/cache.glade +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - True - Zero Install cache - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - True - -11 - - - - - - True - True - True - gtk-delete - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - True - False - True - False - False - False - - - - - 0 - True - True - - - - - - - diff --git a/zeroinstall/gtkui/cache.py b/zeroinstall/gtkui/cache.py index debdab7..1a313f0 100644 --- a/zeroinstall/gtkui/cache.py +++ b/zeroinstall/gtkui/cache.py @@ -213,7 +213,7 @@ class KnownImplementation(CachedImplementation): class CacheExplorer: """A graphical interface for viewing the cache and deleting old items.""" def __init__(self, iface_cache): - widgets = gtkutils.Template(os.path.join(os.path.dirname(__file__), 'cache.glade'), 'cache') + widgets = gtkutils.Template(os.path.join(os.path.dirname(__file__), 'cache.ui'), 'cache') self.window = window = widgets.get_widget('cache') window.set_default_size(gtk.gdk.screen_width() / 2, gtk.gdk.screen_height() / 2) self.iface_cache = iface_cache diff --git a/zeroinstall/gtkui/cache.ui b/zeroinstall/gtkui/cache.ui new file mode 100644 index 0000000..bda73a8 --- /dev/null +++ b/zeroinstall/gtkui/cache.ui @@ -0,0 +1,93 @@ + + + + + + Zero Install cache + dialog + False + + + True + + + True + True + automatic + + + True + True + True + + + + + 1 + + + + + True + end + + + gtk-help + True + True + True + False + True + + + False + False + 0 + + + + + gtk-delete + True + True + True + False + True + + + False + False + 1 + + + + + gtk-close + True + True + True + False + True + + + False + False + 2 + + + + + False + end + 0 + + + + + + helpbutton1 + button1 + closebutton1 + + + diff --git a/zeroinstall/gtkui/desktop.glade b/zeroinstall/gtkui/desktop.glade deleted file mode 100644 index a4cd2f0..0000000 --- a/zeroinstall/gtkui/desktop.glade +++ /dev/null @@ -1,770 +0,0 @@ - - - - - - - True - Add Zero Install Application - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - -6 - - - - - - True - False - True - True - gtk-go-back - True - GTK_RELIEF_NORMAL - True - 0 - - - - - - True - True - True - True - gtk-go-forward - True - GTK_RELIEF_NORMAL - True - 1 - - - - - - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - -5 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - True - False - - - - 4 - True - False - False - GTK_POS_TOP - False - False - - - - 8 - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 0.5 - 0.5 - 1 - 1 - 4 - 0 - 12 - 0 - - - - True - False - 8 - - - - True - <i>Enter the URI of the application you want to install, or drag its link from a web-browser -into this window.</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - URI: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - True - True - 0 - - True - * - True - - - 0 - True - True - - - - - 0 - False - True - - - - - - - - - - True - <b>Application to install</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - False - True - - - - - - True - label4 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - True - False - 10 - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - 4 - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - False - 0 - - - - True - gtk-missing-image - 4 - 0.5 - 0.5 - 4 - 4 - - - 0 - False - True - - - - - - True - label10 - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - True - True - - - - - - - - - - True - <b>About this program</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - True - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - 4 - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 12 - 0 - - - - True - False - 4 - - - - True - <i>Choose a category for the program to determine where it appears in the Applications menu.</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - 0 - - - - True - Category: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - AudioVideo -Audio -Video -Development -Education -Game -Graphics -Network -Office -Settings -System -Utility - - False - True - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - - - True - <b>Applications menu</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - label_item - - - - - 0 - False - True - - - - - False - True - - - - - - True - label5 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - - - - - True - label6 - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - - 0 - True - True - - - - - - - - True - Zero Install applications - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 500 - 500 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - -7 - - - - - - True - Show all Zero Install software currently stored on this computer (i.e. those programs which can be run without a network connection). This can be useful if you're running out of disk space and need to delete something. - True - True - GTK_RELIEF_NORMAL - True - 0 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-properties - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - Show Cache - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - True - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - True - False - True - False - False - False - - - - - - - 0 - True - True - - - - - - - diff --git a/zeroinstall/gtkui/desktop.ui b/zeroinstall/gtkui/desktop.ui new file mode 100644 index 0000000..9fe8da3 --- /dev/null +++ b/zeroinstall/gtkui/desktop.ui @@ -0,0 +1,524 @@ + + + + + + Add Zero Install Application + center + dialog + False + + + True + + + True + + + True + 4 + False + False + + + True + 8 + 0 + none + + + True + 4 + 12 + + + True + 8 + + + True + 0 + Enter the URI of the application you want to install, or drag its link from a web-browser into this window. + + + + + + False + False + 0 + + + + + True + + + True + URI: + + + False + False + 0 + + + + + True + True + True + + + 1 + + + + + False + 1 + + + + + + + + + True + Application to install + + + + + + + + + + True + label4 + + + False + + + + + True + 10 + + + True + 0 + none + + + True + 4 + 12 + + + True + + + True + 4 + 4 + gtk-missing-image + + + False + 0 + + + + + True + 0 + label10 + + + 1 + + + + + + + + + True + About this program + + + + + + + + False + 0 + + + + + True + 0 + none + + + True + 4 + 12 + + + True + 4 + + + True + 0 + Choose a category for the program to determine where it appears in the Applications menu. + + + + + + False + False + 0 + + + + + True + + + True + Category: + + + False + False + 0 + + + + + True + liststore1 + + + + 0 + + + + + 1 + + + + + 1 + + + + + + + + + True + Applications menu + + + + + + + + False + 1 + + + + + 1 + + + + + True + label5 + + + 1 + False + + + + + + + + True + label6 + + + 2 + False + + + + + + + 1 + + + + + True + end + + + gtk-cancel + True + True + True + False + True + + + False + False + 0 + + + + + gtk-go-back + True + False + True + True + False + True + + + False + False + 1 + + + + + gtk-go-forward + True + True + True + True + False + True + + + False + False + 2 + + + + + gtk-ok + True + True + False + True + + + False + False + 3 + + + + + False + end + 0 + + + + + + cancelbutton1 + okbutton1 + dialog_next + dialog_ok + + + + + + + + + + AudioVideo + + + Audio + + + Video + + + Development + + + Education + + + Game + + + Graphics + + + Network + + + Office + + + Settings + + + System + + + Utility + + + + + Zero Install applications + 500 + 500 + dialog + False + + + True + + + True + 0 + none + + + True + True + never + in + + + True + True + False + True + + + + + + + 1 + + + + + True + end + + + gtk-close + True + True + True + False + True + + + False + False + 0 + + + + + True + True + True + False + Show all Zero Install software currently stored on this computer (i.e. those programs which can be run without a network connection). This can be useful if you're running out of disk space and need to delete something. + + + True + 0 + 0 + + + True + 2 + + + True + gtk-properties + + + False + False + 0 + + + + + True + Show Cache + True + + + False + False + 1 + + + + + + + + + False + False + 1 + + + + + False + end + 0 + + + + + + closebutton1 + show_cache + + + diff --git a/zeroinstall/gtkui/gtkutils.py b/zeroinstall/gtkui/gtkutils.py index 35855e5..c2f35c5 100644 --- a/zeroinstall/gtkui/gtkutils.py +++ b/zeroinstall/gtkui/gtkutils.py @@ -5,24 +5,24 @@ from zeroinstall import _ import gtk -import gtk.glade class Template: - """Wrapper for glade widget tree that throws a sensible exception if the widget isn't found.""" - def __init__(self, gladefile, root): + """Wrapper for GtkBuilder widget tree that throws a sensible exception if the widget isn't found.""" + def __init__(self, builderfile, root): """Constructor. - @param gladefile: pathname of the .glade file to load + @param gladefile: pathname of the .ui file to load @param root: the name of the top-level widget inside the file""" - self.widgets = gtk.glade.XML(gladefile, root) - self.gladefile = gladefile + self.builder = gtk.Builder() + self.builder.add_from_file(builderfile) + self.builderfile = builderfile self.root = root def get_widget(self, name = None): """Look up a widget by name.""" if not name: name = self.root - widget = self.widgets.get_widget(name) - assert widget, "Widget '%s' not found in glade file '%s'" % (name, self.gladefile) + widget = self.builder.get_object(name) + assert widget, "Widget '%s' not found in GtkBuilder file '%s'" % (name, self.builderfile) return widget def show_message_box(parent, message, type = gtk.MESSAGE_ERROR): -- 2.11.4.GIT