Commits

Yuki KODAMA committed f8c3be9

thgconfig: minify code for adding notebook pages

Comments (0)

Files changed (1)

tortoisehg/hgtk/thgconfig.py

                   'Examples: en, en_GB, en_US')),)
 
         # create pages for each section of configuration file
-        self.tortoise_frame = self.add_page('TortoiseHg')
-        self.fill_frame(self.tortoise_frame, tortoise_info)
-
-        self.commit_frame = self.add_page(_('Commit'))
-        self.fill_frame(self.commit_frame, _commit_info)
-
-        self.log_frame = self.add_page(_('Changelog'))
-        self.fill_frame(self.log_frame, _log_info)
-
-        self.paths_frame = self.add_page(_('Sync'))
-        vbox = self.fill_frame(self.paths_frame, _paths_info)
-        self.fill_path_frame(vbox)
-
-        self.web_frame = self.add_page(_('Web'))
-        self.fill_frame(self.web_frame, _web_info)
-
-        self.proxy_frame = self.add_page(_('Proxy'))
-        self.fill_frame(self.proxy_frame, _proxy_info)
-
-        self.email_frame = self.add_page(_('Email'))
-        self.fill_frame(self.email_frame, _email_info)
-
-        self.diff_frame = self.add_page(_('Diff'))
-        self.fill_frame(self.diff_frame, _diff_info)
+        self.add_page('TortoiseHg', tortoise_info)
+        self.add_page(_('Commit'), _commit_info)
+        self.add_page(_('Changelog'), _log_info)
+        self.add_page(_('Sync'), _paths_info, path=True)
+        self.add_page(_('Web'), _web_info)
+        self.add_page(_('Proxy'), _proxy_info)
+        self.add_page(_('Email'), _email_info)
+        self.add_page(_('Diff'), _diff_info)
 
         self.configrepo = configrepo
 
                 elif currow:
                     combo.set_active(currow)
 
-    def add_page(self, tab):
+    def add_page(self, tab, info, path=False):
         frame = gtk.VBox()
         frame.set_border_width(4)
         frame.show()
 
+        vbox = self.fill_frame(frame, info)
+        if path:
+            self.fill_path_frame(vbox)
+
         label = gtk.Label(tab)
         self.notebook.append_page(frame, label)
         return frame
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.