[Pkg-privacy-commits] [torbrowser-launcher] 115/476: started interface for settings dialog (#29)

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:21:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch debian
in repository torbrowser-launcher.

commit f772ec2be4987e77168846bb7ef38866fc3e4f79
Author: Micah Lee <micahflee at riseup.net>
Date:   Mon Apr 15 21:15:26 2013 -0700

    started interface for settings dialog (#29)
---
 torbrowser-launcher | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 96 insertions(+), 2 deletions(-)

diff --git a/torbrowser-launcher b/torbrowser-launcher
index 3e34277..586678a 100755
--- a/torbrowser-launcher
+++ b/torbrowser-launcher
@@ -251,6 +251,100 @@ class TBLSettings:
     def __init__(self, common):
         print _('Starting settings dialog')
         self.common = common
+        self.common.load_settings()
+
+        # set up the window
+        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window.set_title(_("Tor Browser Launcher Settings"))
+        self.window.set_icon_from_file(self.common.paths['file']['icon'])
+        self.window.set_position(gtk.WIN_POS_CENTER)
+        self.window.set_border_width(10)
+        self.window.connect("delete_event", self.delete_event)
+        self.window.connect("destroy", self.destroy)
+        
+        # build the rest of the UI
+        self.box = gtk.VBox(False, 20)
+        self.window.add(self.box)
+
+        # labels
+        if(self.common.settings['installed_version']):
+            self.label1 = gtk.Label(_('Installed version: {0}').format(self.common.settings['installed_version']))
+        else:
+            self.label1 = gtk.Label(_('Tor Browser Bundle not installed'))
+        self.label1.set_line_wrap(True)
+        self.box.pack_start(self.label1, True, True, 0)
+        self.label1.show()
+
+        if(self.common.settings['last_update_check_timestamp'] > 0):
+            self.label1 = gtk.Label(_('Last checked for updates: {0}').format(time.strftime("%B %d, %Y %I:%M %P", time.gmtime(self.common.settings['last_update_check_timestamp']))))
+        else:
+            self.label1 = gtk.Label(_('Never checked for updates'))
+        self.label1.set_line_wrap(True)
+        self.box.pack_start(self.label1, True, True, 0)
+        self.label1.show()
+
+        # button box
+        self.button_box = gtk.HButtonBox()
+        self.button_box.set_layout(gtk.BUTTONBOX_SPREAD)
+        self.box.pack_start(self.button_box, True, True, 0)
+        self.button_box.show()
+        
+
+        # save and launch button
+        save_launch_image = gtk.Image()
+        save_launch_image.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON)
+        self.save_launch_button = gtk.Button(_("Launch Tor Browser"))
+        self.save_launch_button.set_image(save_launch_image)
+        self.save_launch_button.connect("clicked", self.save_launch, None)
+        self.button_box.add(self.save_launch_button)
+        self.save_launch_button.show()
+
+        # save and exit button
+        save_exit_image = gtk.Image()
+        save_exit_image.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON)
+        self.save_exit_button = gtk.Button(_("Save & Exit"))
+        self.save_exit_button.set_image(save_exit_image)
+        self.save_exit_button.connect("clicked", self.save_exit, None)
+        self.button_box.add(self.save_exit_button)
+        self.save_exit_button.show()
+
+        # cancel button
+        cancel_image = gtk.Image()
+        cancel_image.set_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_BUTTON)
+        self.cancel_button = gtk.Button(_("Cancel"))
+        self.cancel_button.set_image(cancel_image)
+        self.cancel_button.connect("clicked", self.destroy, None)
+        self.button_box.add(self.cancel_button)
+        self.cancel_button.show()
+
+        # show the window
+        self.box.show()
+        self.window.show()
+
+        # start gtk
+        gtk.main()
+
+    # save and launch
+    def save_launch(self, widget, data=None):
+        self.save()
+        p = subprocess.Popen([self.common.paths['file']['tbl_bin']])
+        self.destroy(False)
+
+    # save and exit
+    def save_exit(self, widget, data=None):
+        self.save()
+        self.destroy(False)
+
+    # save settings
+    def save(self):
+        pass
+
+    # exit
+    def delete_event(self, widget, event, data=None):
+        return False
+    def destroy(self, widget, data=None):
+        gtk.main_quit()
+
 
 class TBLLauncher:
     def __init__(self, common):
@@ -417,7 +511,7 @@ class TBLLauncher:
             # start button
             start_image = gtk.Image()
             start_image.set_from_stock(gtk.STOCK_APPLY, gtk.ICON_SIZE_BUTTON)
-            self.start_button = gtk.Button("Start")
+            self.start_button = gtk.Button(_("Start"))
             self.start_button.set_image(start_image)
             self.start_button.connect("clicked", self.start, None)
             self.button_box.add(self.start_button)
@@ -427,7 +521,7 @@ class TBLLauncher:
             # exit button
             exit_image = gtk.Image()
             exit_image.set_from_stock(gtk.STOCK_CANCEL, gtk.ICON_SIZE_BUTTON)
-            self.exit_button = gtk.Button("Exit")
+            self.exit_button = gtk.Button(_("Exit"))
             self.exit_button.set_image(exit_image)
             self.exit_button.connect("clicked", self.destroy, None)
             self.button_box.add(self.exit_button)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list