Ejemplo n.º 1
0
 def OnOK(self, e):
     if self.CheckUPX() and self.CheckPyi():
         config = controller.getConfig()
         config['noconfirm'] = self.cbnoconfirm.GetValue()
         config['singlefile'] = self.cbsinglefile.GetValue()
         config['ascii'] = self.cbascii.GetValue()
         config['windowed'] = self.cbwindowed.GetValue()
         config['upxdir'] = self.upx.GetValue()
         config['pyidir'] = self.pyi.GetValue()
         logging.info("Preferences Saved")
         config.write()
         self.Destroy()
Ejemplo n.º 2
0
 def OnOK(self, e):
     if self.CheckUPX() and self.CheckPyi():
         config = controller.getConfig()
         config['noconfirm'] = self.cbnoconfirm.GetValue()
         config['singlefile'] = self.cbsinglefile.GetValue()
         config['ascii'] = self.cbascii.GetValue()
         config['windowed'] = self.cbwindowed.GetValue()
         config['upxdir'] = self.upx.GetValue()
         config['pyidir'] = self.pyi.GetValue()
         logging.info("Preferences Saved")
         config.write()
         self.Destroy()
Ejemplo n.º 3
0
    def InitUI(self):
        config = controller.getConfig()
        self.panel = wx.Panel(self)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        vbox = wx.BoxSizer(wx.VERTICAL)
        grid1 = wx.FlexGridSizer(0,1,0,0)
        
        self.upx = filebrowse.DirBrowseButton(self.panel, -1, size=(350,-1),  labelText='UPX Directory:',
                    changeCallback = self.upxCallback)
        self.upx.SetValue(config['upxdir'])
        self.pyi = filebrowse.DirBrowseButton(self.panel, -1, size=(350, -1), labelText='PyInstaller Directory:',
                                              changeCallback = self.pyiCallback)
        self.pyi.SetValue(config['pyidir'])
        
        box_title = wx.StaticBox(self.panel, -1, "Default Options")
        box = wx.StaticBoxSizer(box_title, wx.VERTICAL)
        
        self.cb_ctrls = []
        self.cbnoconfirm = wx.CheckBox(self.panel, -1, "Remove output directory without confirmation",
                                     style=wx.RB_GROUP)
        self.cbsinglefile = wx.CheckBox(self.panel, -1, "Create a single file deployment")
        self.cbascii = wx.CheckBox(self.panel, -1, "Do not include unicode encoding")
        self.cbwindowed = wx.CheckBox(self.panel, -1, "Do not open the console when program is launched.")
        
        self.cb_ctrls.append(self.cbnoconfirm)
        self.cb_ctrls.append(self.cbsinglefile)
        self.cb_ctrls.append(self.cbascii)
        self.cb_ctrls.append(self.cbwindowed)
        
        self.cbnoconfirm.SetValue(config['noconfirm'])
        self.cbsinglefile.SetValue(config['singlefile'])
        self.cbascii.SetValue(config['ascii'])
        self.cbwindowed.SetValue(config['windowed'])
        
        btnOK = wx.Button(self.panel, wx.ID_OK, 'OK')
        btnCancel = wx.Button(self.panel, wx.ID_CANCEL, 'Cancel')
        btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
        
        vbox.Add(self.pyi, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5)
        vbox.Add(self.upx, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5)
        for cb in self.cb_ctrls:
            grid1.Add(cb,0,wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5)
        box.Add(grid1, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        vbox.Add(box, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        hbox.Add(btnOK, 0, flag=wx.wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        hbox.Add(btnCancel, 0, flag=wx.RIGHT|wx.TOP, border=10)
        vbox.Add(hbox, flag=wx.ALIGN_RIGHT)

        self.panel.SetSizer(vbox)
Ejemplo n.º 4
0
 def CheckPyi(self):
     pyiname = ('pyinstaller.py', 'pyinstaller')
     pyscript = [i for i in pyiname if i in os.listdir(self.pyi.GetValue())]
     if pyscript:
         config = controller.getConfig()
         config['pyscript'] = pyscript[0]
         logging.debug('Pyinstaller script: {} saved'.format(pyscript))
         config.write()
         return True
     else:
         dial = wx.MessageDialog(
             None, 'pyinstaller.py not found. Please check path.',
             'Pyinstaller not found', wx.OK | wx.ICON_ERROR)
         dial.ShowModal()
         dial.Destroy()
         return False
Ejemplo n.º 5
0
 def CheckPyi(self):
     pyiname = ('pyinstaller.py', 'pyinstaller')
     pyscript = [i for i in pyiname if i in os.listdir(self.pyi.GetValue())]
     if pyscript:
         config = controller.getConfig()
         config['pyscript'] = pyscript[0]
         logging.debug('Pyinstaller script: {} saved'.format(pyscript))
         config.write()
         return True
     else:
         dial = wx.MessageDialog(None, 'pyinstaller.py not found. Please check path.',
                                  'Pyinstaller not found', 
         wx.OK | wx.ICON_ERROR)
         dial.ShowModal()
         dial.Destroy()
         return False
Ejemplo n.º 6
0
def getflags(fname):
    config = controller.getConfig()
    flags=[]
    flags.append(sys.executable) # Python executable to run pyinstaller
    flags.append(os.path.join(config['pyidir'], config['pyscript']))
    if config['noconfirm']:
        flags.append('--noconfirm')
    if config['singlefile']:
        flags.append('--onefile')
    if config['ascii']:
        flags.append('--ascii')
    if config['windowed']:
        flags.append('--noconsole')
    if config['upxdir'] != '':
        flags.append('--upx-dir=' + config['upxdir'])
    if pyversion(config['pyidir']) == 2.1:
        flags.append('--distpath=' + os.path.dirname(fname)) # Output to same dir as script.
    else:
        flags.append('--out=' + os.path.dirname(fname))
    flags.append(fname)
    return(flags)
Ejemplo n.º 7
0
def getflags(fname):
    config = controller.getConfig()
    flags = []
    flags.append(sys.executable)  # Python executable to run pyinstaller
    flags.append(os.path.join(config['pyidir'], config['pyscript']))
    if config['noconfirm']:
        flags.append('--noconfirm')
    if config['singlefile']:
        flags.append('--onefile')
    if config['ascii']:
        flags.append('--ascii')
    if config['windowed']:
        flags.append('--noconsole')
    if config['upxdir'] != '':
        flags.append('--upx-dir=' + config['upxdir'])
    if pyversion(config['pyidir']) == 2.1:
        flags.append('--distpath=' +
                     os.path.dirname(fname))  # Output to same dir as script.
    else:
        flags.append('--out=' + os.path.dirname(fname))
    flags.append(fname)
    return (flags)
Ejemplo n.º 8
0
    def InitUI(self):
        config = controller.getConfig()
        self.panel = wx.Panel(self)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        vbox = wx.BoxSizer(wx.VERTICAL)
        grid1 = wx.FlexGridSizer(0, 1, 0, 0)

        self.upx = filebrowse.DirBrowseButton(self.panel,
                                              -1,
                                              size=(350, -1),
                                              labelText='UPX Directory:',
                                              changeCallback=self.upxCallback)
        self.upx.SetValue(config['upxdir'])
        self.pyi = filebrowse.DirBrowseButton(
            self.panel,
            -1,
            size=(350, -1),
            labelText='PyInstaller Directory:',
            changeCallback=self.pyiCallback)
        self.pyi.SetValue(config['pyidir'])

        box_title = wx.StaticBox(self.panel, -1, "Default Options")
        box = wx.StaticBoxSizer(box_title, wx.VERTICAL)

        self.cb_ctrls = []
        self.cbnoconfirm = wx.CheckBox(
            self.panel,
            -1,
            "Remove output directory without confirmation",
            style=wx.RB_GROUP)
        self.cbsinglefile = wx.CheckBox(self.panel, -1,
                                        "Create a single file deployment")
        self.cbascii = wx.CheckBox(self.panel, -1,
                                   "Do not include unicode encoding")
        self.cbwindowed = wx.CheckBox(
            self.panel, -1,
            "Do not open the console when program is launched.")

        self.cb_ctrls.append(self.cbnoconfirm)
        self.cb_ctrls.append(self.cbsinglefile)
        self.cb_ctrls.append(self.cbascii)
        self.cb_ctrls.append(self.cbwindowed)

        self.cbnoconfirm.SetValue(config['noconfirm'])
        self.cbsinglefile.SetValue(config['singlefile'])
        self.cbascii.SetValue(config['ascii'])
        self.cbwindowed.SetValue(config['windowed'])

        btnOK = wx.Button(self.panel, wx.ID_OK, 'OK')
        btnCancel = wx.Button(self.panel, wx.ID_CANCEL, 'Cancel')
        btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)

        vbox.Add(self.pyi, 0, wx.ALIGN_CENTRE | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        vbox.Add(self.upx, 0, wx.ALIGN_CENTRE | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        for cb in self.cb_ctrls:
            grid1.Add(cb, 0, wx.ALIGN_CENTRE | wx.LEFT | wx.RIGHT | wx.TOP, 5)
        box.Add(grid1, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        vbox.Add(box, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        hbox.Add(btnOK, 0, flag=wx.wx.LEFT | wx.RIGHT | wx.TOP, border=10)
        hbox.Add(btnCancel, 0, flag=wx.RIGHT | wx.TOP, border=10)
        vbox.Add(hbox, flag=wx.ALIGN_RIGHT)

        self.panel.SetSizer(vbox)
Ejemplo n.º 9
0
def pyversion(installdir):
    config = controller.getConfig()
    sys.path.insert(0, installdir)
    from PyInstaller import get_version
    return float(get_version()[:3])
Ejemplo n.º 10
0
def pyversion(installdir):
    config = controller.getConfig()
    sys.path.insert(0, installdir)
    from PyInstaller import get_version
    return float(get_version()[:3])