Source

vpackager / src / vpackager / guitools.py

Diff from to

src/vpackager/guitools.py

         mod.append(['Description URI', info['descURI']])
         mod.append(['Source Type', info['type']])
         mod.append(['Install After Build', info['install']=="1"])
+        mod.append(['Custom build options', info['config']])
+        mod.append(['Post-install script', info['doinstURI']])
         if patchlist:
             mod.append(['Patches to be applied', patchlist[0]])
             for x in range(1, len(patchlist)):
         mod.append(['Build Ended', info['buildend']])
         mod.append(['Build Result', info['result']])
         mod.append(['Output Log', info['stdout']])
+        mod.append(['Custom Build Options', info['config']])
+        mod.append(['Post-install script', info['doinstURI']])
         if patches:
             patchlist = patches.split(',')
             patchlist = (['Patches Applied', patchlist[0]])
         self.patches = []
         self.release = 1
         self.install = False
-        self.patchesbox = self._patchesbox()
+        self.config_options = ""
+        self.doinstURI = ""
+        self.advancedbox = self._advancedbox()
         self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
         self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
         self.set_has_separator(True)
         body.pack_start(bbox, False, True, 2)
         # Patches box
         #exPatches = gtk.expander_new_with_mnemonic('Patches')
-        exPatches = gtk.Expander('Patches')
-        exPatches.add(self.patchesbox)
+        exPatches = gtk.Expander('Advanced Options')
+        exPatches.add(self.advancedbox)
         exPatches.connect('notify::expanded', self._expander_event)
         body.pack_start(exPatches, True, True, 4)
 
         self.app = data
         self.appEntry.set_text((data or ""))
 
+    def set_config(self, data):
+        self.configEntry.set_text((data or ""))
+        self.config_options = data
+
+    def set_doinst(self, data):
+        self.doinstEntry.set_text((data or ""))
+        self.doinstURI = data
+
     def set_src(self, data):
         self.SrcURI = data
         self.srcentry.set_text((data or ""))
             model.append([patch])
         return
 
-    def _patchesbox(self):
+    def _advancedbox(self):
+        gbox = gtk.VBox()
         box = gtk.HBox()
+        frmpatches = gtk.Frame('Patches')
         rbox = gtk.VBox()
         lst = gtk.ListStore(str)
         cr = gtk.CellRendererText()
         btDelPatch.connect('clicked', self._del_patch_event)
         rbox.pack_start(btAddPatch, False ,False, 2)
         rbox.pack_start(btDelPatch, False ,False, 2)
-        return box
+        frmpatches.add(box)
+
+        # Add an area to provide custom configure options.
+        lb = gtk.Label("Extra configure options. (Autoconf sources only)")
+        lb.set_property('xalign', 0.0)
+        entry_conf_options = gtk.Entry()
+        self.configEntry = entry_conf_options
+        entry_conf_options.connect('changed', self.on_conf_options_change)
+        doinstbox = gtk.HBox()
+        doinst_lb = gtk.Label('Post Install Script:')
+        doinst_lb.set_property('xalign', 0.0)
+        gbox.pack_start(doinst_lb, False, True, 2)
+        doinst_en = gtk.Entry()
+        self.doinstEntry = doinst_en
+        doinst_bt = vButton(stock=gtk.STOCK_OPEN, label='Select')
+        doinst_bt.connect('clicked', self.on_select_doinst)
+        doinst_en.set_tooltip_text('Enter URL, path or click "Select"')
+        #doinstbox.pack_start(doinst_lb, False, False, 2)
+        doinstbox.pack_start(doinst_en, True, True, 2)
+        doinstbox.pack_start(doinst_bt, False, False, 2)
+        gbox.pack_start(doinstbox, False, True, 2)
+        gbox.pack_start(lb, False, True, 2)
+        gbox.pack_start(entry_conf_options, False, True, 2)
+        gbox.pack_start(frmpatches, True, True, 2)
+
+
+        return gbox
+
+    def on_conf_options_change(self, widget=None):
+        self.config_options = widget.get_text()
+
+    def on_select_doinst(self, widget=None):
+        """Pop a dialog to select the install script"""
+        dia = FilePicker(title="Select post-install script",
+                         forsrc=False, plaintxt=True)
+        res = dia.run()
+        dia.hide()
+        if res == gtk.STOCK_OK:
+            self.doinstEntry.set_text(dia.get_filename())
+            self.doinstURI = self.doinstEntry.get_text()
+        return
+
 
     def _expander_event(self, widget=None, user_data=None):
         ''' Resize the dialog to display the newly added widgets'''
-        ht = self.patchesbox.get_allocation()[-2]
-        ht = int(max(ht, 495)*0.25)
+        ht = self.advancedbox.get_allocation()[-2]
+        ht = int(max(ht, 820)*0.25)
         wwid,whei =  self.get_size()
         if widget.get_expanded():
-            self.patchesbox.show()
+            self.advancedbox.show()
             self.resize(wwid, whei + ht)
         else:
-            self.patchesbox.hide()
+            self.advancedbox.hide()
             self.resize(wwid, whei - ht)
         return