Example #1
0
    def doLayout(self):
        """Do layout"""
        dialogSizer = wx.BoxSizer(wx.VERTICAL)

        # dsn input
        dialogSizer.Add(self.dsnInput, proportion=0,
                        flag=wx.EXPAND)

        #
        # list of DXF layers
        #
        layerSizer = wx.StaticBoxSizer(self.layerBox, wx.HORIZONTAL)

        layerSizer.Add(self.list, proportion=1,
                       flag=wx.ALL | wx.EXPAND, border=5)

        dialogSizer.Add(
            layerSizer,
            proportion=1,
            flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND,
            border=5)

        dialogSizer.Add(self.override, proportion=0,
                        flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)

        dialogSizer.Add(self.overwrite, proportion=0,
                        flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)

        dialogSizer.Add(self.add, proportion=0,
                        flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)

        dialogSizer.Add(self.closeOnFinish, proportion=0,
                        flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
        #
        # buttons
        #
        btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)

        btnsizer.Add(self.btn_close, proportion=0,
                     flag=wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER,
                     border=10)

        btnsizer.Add(self.btn_run, proportion=0,
                     flag=wx.RIGHT | wx.ALIGN_CENTER,
                     border=10)

        dialogSizer.Add(
            btnsizer,
            proportion=0,
            flag=wx.BOTTOM | wx.ALIGN_RIGHT,
            border=10)

        # dialogSizer.SetSizeHints(self.panel)
        self.panel.SetAutoLayout(True)
        self.panel.SetSizer(dialogSizer)
        dialogSizer.Fit(self.panel)

        # auto-layout seems not work here - FIXME
        size = wx.Size(globalvar.DIALOG_GSELECT_SIZE[0] + 322, 550)
        self.SetMinSize(size)
        self.SetSize((size.width, size.height + 100))
        # width = self.GetSize()[0]
        # self.list.SetColumnWidth(col = 1, width = width / 2 - 50)
        self.Layout()
Example #2
0
    def __init__(self, parent, dialog):
        wx.Panel.__init__(self, parent, -1)
        
        self.dialog = dialog
        self.utility = dialog.utility

        outerbox = wx.BoxSizer(wx.VERTICAL)

        # Make torrent of:
        maketorrent_box = wx.BoxSizer(wx.HORIZONTAL)
        maketorrent_box.Add(wx.StaticText(self, -1, self.utility.lang.get('maketorrentof')), 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        self.dirCtl = wx.TextCtrl(self, -1, '')
        maketorrent_box.Add(self.dirCtl, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND|wx.ALL, 5)

        button = wx.Button(self, -1, self.utility.lang.get('dir'), style = wx.BU_EXACTFIT)
        wx.EVT_BUTTON(self, button.GetId(), self.selectDir)
        maketorrent_box.Add(button, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        button2 = wx.Button(self, -1, self.utility.lang.get('file'), style = wx.BU_EXACTFIT)
        wx.EVT_BUTTON(self, button2.GetId(), self.selectFile)
        maketorrent_box.Add(button2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        outerbox.Add(maketorrent_box, 0, wx.EXPAND)        

        # Merkle:
        merkletorrent_box = wx.BoxSizer(wx.HORIZONTAL)
        self.createmerkletorrent = wx.CheckBox(self, -1, self.utility.lang.get('createmerkletorrent'))
        merkletorrent_box.Add(self.createmerkletorrent, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
        outerbox.Add(merkletorrent_box, 0, wx.EXPAND)

        # Piece size:
        piecesize_box = wx.BoxSizer(wx.HORIZONTAL)
        
        piecesize_box.Add(wx.StaticText(self, -1, self.utility.lang.get('piecesize')), 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
        
        abbrev_mb = " " + self.utility.lang.get('MB')
        abbrev_kb = " " + self.utility.lang.get('KB')
        
        piece_choices = [self.utility.lang.get('automatic'), 
                         '2' + abbrev_mb, 
                         '1' + abbrev_mb, 
                         '512' + abbrev_kb, 
                         '256' + abbrev_kb, 
                         '128' + abbrev_kb, 
                         '64' + abbrev_kb, 
                         '32' + abbrev_kb]
        self.piece_length = wx.Choice(self, -1, choices = piece_choices)
        self.piece_length_list = [0, 2**21, 2**20, 2**19, 2**18, 2**17, 2**16, 2**15]
        piecesize_box.Add(self.piece_length, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
        
        outerbox.Add(piecesize_box, 0, wx.EXPAND)
        

#        panel.DragAcceptFiles(True)
#        wx.EVT_DROP_FILES(panel, self.selectdrop)

        # Save torrent :
        savetorrentbox = wx.StaticBoxSizer(wx.StaticBox(self, -1, self.utility.lang.get('savetor')), wx.VERTICAL)

        self.savetorrb1 = wx.RadioButton(self, -1, self.utility.lang.get('savetordefault'), (-1, -1), (-1, -1), wx.RB_GROUP)
        savetorrb2 = wx.RadioButton(self, -1, self.utility.lang.get('savetorsource'), (-1, -1), (-1, -1))
        savetorrb3 = wx.RadioButton(self, -1, self.utility.lang.get('savetorask'), (-1, -1), (-1, -1))
        self.savetor = [self.savetorrb1, savetorrb2, savetorrb3]

        savetordefbox = wx.BoxSizer(wx.HORIZONTAL)
        savetordefbox.Add(self.savetorrb1, 0, wx.ALIGN_CENTER_VERTICAL)
        self.savetordeftext = wx.TextCtrl(self, -1, "")
        browsebtn = wx.Button(self, -1, "...", style = wx.BU_EXACTFIT)
        browsebtn.Bind(wx.EVT_BUTTON, self.onBrowseDir)
        savetordefbox.Add(self.savetordeftext, 1, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        savetordefbox.Add(browsebtn, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, 3)
        savetorrentbox.Add(savetordefbox, 0, wx.EXPAND)
        
        savetorrentbox.Add(savetorrb2, 0)

        savetorrentbox.Add(savetorrb3, 0, wx.TOP, 4)

        outerbox.Add(savetorrentbox, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)

        optionalhash_title = wx.StaticBox(self, -1, self.utility.lang.get('makehash_optional'))
        optionalhash = wx.StaticBoxSizer(optionalhash_title, wx.VERTICAL)

        self.makehash_md5 = wx.CheckBox(self, -1, self.utility.lang.get('makehash_md5'))
        optionalhash.Add(self.makehash_md5, 0)

        self.makehash_crc32 = wx.CheckBox(self, -1, self.utility.lang.get('makehash_crc32'))
        optionalhash.Add(self.makehash_crc32, 0, wx.TOP, 4)

        self.makehash_sha1 = wx.CheckBox(self, -1, self.utility.lang.get('makehash_sha1'))
        optionalhash.Add(self.makehash_sha1, 0, wx.TOP, 4)
        
        self.createtorrentsig = wx.CheckBox(self, -1, self.utility.lang.get('createtorrentsig'))
        optionalhash.Add(self.createtorrentsig, 0, wx.TOP, 4)

        outerbox.Add(optionalhash, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)

        self.startnow = wx.CheckBox(self, -1, self.utility.lang.get('startnow'))
        outerbox.Add(self.startnow, 0, wx.ALIGN_LEFT|wx.ALL, 5)

        self.SetSizerAndFit(outerbox)
        
        self.loadValues()
    def __do_layout(self):
        grid_sizer_base = wx.FlexGridSizer(rows=3, cols=1, vgap=10, hgap=10)

        # Paramètres
        box_param = wx.StaticBoxSizer(self.box_param_staticbox, wx.VERTICAL)
        grid_sizer_param = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5)

        grid_sizer_param.Add(self.label_periode, 0,
                             wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_periode = wx.FlexGridSizer(rows=1, cols=4, vgap=5, hgap=5)
        grid_sizer_periode.Add(self.label_du, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_periode.Add(self.ctrl_date_debut, 0, 0, 0)
        grid_sizer_periode.Add(self.label_au, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_periode.Add(self.ctrl_date_fin, 0, 0, 0)
        grid_sizer_param.Add(grid_sizer_periode, 1, wx.EXPAND, 0)

        grid_sizer_param.Add(self.label_niveau, 0,
                             wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_param.Add(self.ctrl_niveau, 0, wx.EXPAND, 0)

        grid_sizer_param.AddGrowableCol(1)
        box_param.Add(grid_sizer_param, 1, wx.ALL | wx.EXPAND, 10)

        grid_sizer_base.Add(box_param, 1,
                            wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, 10)

        # Individus
        box_individus = wx.StaticBoxSizer(self.box_individus_staticbox,
                                          wx.VERTICAL)
        grid_sizer_individus = wx.FlexGridSizer(rows=6, cols=1, vgap=5, hgap=5)

        # Filtres Individus
        grid_sizer_filtres = wx.FlexGridSizer(rows=4, cols=2, vgap=5, hgap=5)

        grid_sizer_filtres.Add(self.label_filtre_periode, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_filtre_periode = wx.FlexGridSizer(rows=1,
                                                     cols=4,
                                                     vgap=5,
                                                     hgap=5)
        grid_sizer_filtre_periode.Add(
            self.label_filtre_du, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
            0)
        grid_sizer_filtre_periode.Add(self.ctrl_filtre_date_debut, 0, 0, 0)
        grid_sizer_filtre_periode.Add(
            self.label_filtre_au, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
            0)
        grid_sizer_filtre_periode.Add(self.ctrl_filtre_date_fin, 0, 0, 0)
        grid_sizer_filtres.Add(grid_sizer_filtre_periode, 1, wx.EXPAND, 0)

        grid_sizer_filtres.Add(self.label_filtre_ecole, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_filtres.Add(self.ctrl_filtre_ecole, 0, wx.EXPAND, 0)
        grid_sizer_filtres.Add(self.label_filtre_classe, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_filtres.Add(self.ctrl_filtre_classe, 0, wx.EXPAND, 0)
        grid_sizer_filtres.Add(self.label_filtre_niveau, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_filtres.Add(self.ctrl_filtre_niveau, 0, wx.EXPAND, 0)
        grid_sizer_filtres.AddGrowableCol(1)
        grid_sizer_individus.Add(grid_sizer_filtres, 1, wx.EXPAND, 0)

        # CTRL individus
        grid_sizer_individus.Add(self.ctrl_individus, 0, wx.TOP | wx.EXPAND,
                                 10)

        # Hyperliens
        grid_sizer_hyperliens = wx.FlexGridSizer(rows=1,
                                                 cols=5,
                                                 vgap=5,
                                                 hgap=5)
        grid_sizer_hyperliens.Add(self.ctrl_recherche, 0, wx.EXPAND, 0)
        grid_sizer_hyperliens.AddGrowableCol(0)
        grid_sizer_individus.Add(grid_sizer_hyperliens, 1, wx.EXPAND, 0)

        grid_sizer_individus.AddGrowableRow(1)
        grid_sizer_individus.AddGrowableCol(0)
        box_individus.Add(grid_sizer_individus, 1, wx.ALL | wx.EXPAND, 10)
        grid_sizer_base.Add(box_individus, 1, wx.LEFT | wx.RIGHT | wx.EXPAND,
                            10)

        # Boutons
        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10)
        grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0)
        grid_sizer_boutons.Add((20, 20), 0, wx.EXPAND, 0)
        grid_sizer_boutons.Add(self.bouton_ok, 0, 0, 0)
        grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_boutons, 1,
                            wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 10)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableRow(1)
        grid_sizer_base.AddGrowableCol(0)
        self.Layout()
        self.CenterOnScreen()
Example #4
0
    def __init__(self, parent, torrentlist):

        self.utility = parent.utility

        title = self.utility.lang.get('localsetting')

        pre = wx.PreDialog()
        pre.Create(parent, -1, title)
        self.this = pre.this
        self.torrentlist = torrentlist

        outerbox = wx.BoxSizer(wx.VERTICAL)

        leftrightbox = wx.BoxSizer(wx.HORIZONTAL)
        leftbox = wx.BoxSizer(wx.VERTICAL)
        rightbox = wx.BoxSizer(wx.VERTICAL)

        # GUI for local upload setting
        ################################

        # Upload setting
        ########################################

        uploadsection_title = wx.StaticBox(
            self, -1, self.utility.lang.get('uploadsetting'))
        uploadsection = wx.StaticBoxSizer(uploadsection_title, wx.VERTICAL)

        self.maxupload = wx.SpinCtrl(self, size=wx.Size(60, -1))
        self.maxupload.SetRange(2, 100)

        maxuploadsbox = wx.BoxSizer(wx.HORIZONTAL)
        maxuploadsbox.Add(
            wx.StaticText(self, -1, self.utility.lang.get('maxuploads')), 0,
            wx.ALIGN_CENTER_VERTICAL)
        maxuploadsbox.Add(self.maxupload, 0,
                          wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)

        uploadsection.Add(maxuploadsbox, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                          5)

        maxuploadratebox = wx.BoxSizer(wx.HORIZONTAL)
        maxuploadratebox.Add(
            wx.StaticText(self, -1, self.utility.lang.get('maxuploadrate')), 0,
            wx.ALIGN_CENTER_VERTICAL)

        self.uploadrate = self.utility.makeNumCtrl(self, 0, integerWidth=4)
        maxuploadratebox.Add(self.uploadrate, 0,
                             wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        maxuploadratebox.Add(
            wx.StaticText(
                self, -1,
                self.utility.lang.get('KB') + "/" +
                self.utility.lang.get('l_second')), 0,
            wx.ALIGN_CENTER_VERTICAL)

        uploadsection.Add(maxuploadratebox, 0,
                          wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
        uploadsection.Add(
            wx.StaticText(self, -1, self.utility.lang.get('zeroisauto')), 0,
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, 5)

        leftbox.Add(uploadsection, 0, wx.EXPAND | wx.ALL, 5)

        # Download setting
        ########################################

        downloadsection_title = wx.StaticBox(
            self, -1, self.utility.lang.get('downloadsetting'))
        downloadsection = wx.StaticBoxSizer(downloadsection_title, wx.VERTICAL)

        maxdownloadratebox = wx.BoxSizer(wx.HORIZONTAL)
        maxdownloadratebox.Add(
            wx.StaticText(self, -1, self.utility.lang.get('maxdownloadrate')),
            0, wx.ALIGN_CENTER_VERTICAL)

        self.downloadrate = self.utility.makeNumCtrl(self, 0, integerWidth=4)
        maxdownloadratebox.Add(self.downloadrate, 0,
                               wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        maxdownloadratebox.Add(
            wx.StaticText(
                self, -1,
                self.utility.lang.get('KB') + "/" +
                self.utility.lang.get('l_second')), 0,
            wx.ALIGN_CENTER_VERTICAL)

        downloadsection.Add(maxdownloadratebox, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
        downloadsection.Add(
            wx.StaticText(self, -1, self.utility.lang.get('zeroisauto')), 0,
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, 5)

        leftbox.Add(downloadsection, 0, wx.EXPAND | wx.ALL, 5)

        # Upload setting for completed file
        ########################################

        continuesection_title = wx.StaticBox(
            self, -1, self.utility.lang.get('uploadoptforcompletedfile'))
        continuesection = wx.StaticBoxSizer(continuesection_title, wx.VERTICAL)

        uploadlist = [
            self.utility.lang.get('unlimitedupload'),
            self.utility.lang.get('continueuploadfor'),
            self.utility.lang.get('untilratio')
        ]

        rb1 = wx.RadioButton(self, -1, uploadlist[0], wx.Point(-1, -1),
                             wx.Size(-1, -1), wx.RB_GROUP)
        rb2 = wx.RadioButton(self, -1, uploadlist[1], wx.Point(-1, -1),
                             wx.Size(-1, -1))
        rb3 = wx.RadioButton(self, -1, uploadlist[2], wx.Point(-1, -1),
                             wx.Size(-1, -1))
        self.rb = [rb1, rb2, rb3]

        mtimeval = ['30', '45', '60', '75']
        htimeval = []
        for i in range(24):
            htimeval.append(str(i))

        self.cbhtime = wx.ComboBox(self, -1, "", wx.Point(-1, -1),
                                   wx.Size(37, -1), htimeval,
                                   wx.CB_DROPDOWN | wx.CB_READONLY)
        self.cbmtime = wx.ComboBox(self, -1, "", wx.Point(-1, -1),
                                   wx.Size(37, -1), mtimeval,
                                   wx.CB_DROPDOWN | wx.CB_READONLY)

        continuesection.Add(rb1, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        time_sizer = wx.BoxSizer(wx.HORIZONTAL)
        time_sizer.Add(rb2, 0, wx.ALIGN_CENTER_VERTICAL)
        time_sizer.Add(self.cbhtime, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        time_sizer.Add(wx.StaticText(self, -1, self.utility.lang.get('hour')),
                       0, wx.ALIGN_CENTER_VERTICAL)
        time_sizer.Add(self.cbmtime, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
        time_sizer.Add(
            wx.StaticText(self, -1, self.utility.lang.get('minute')), 0,
            wx.ALIGN_CENTER_VERTICAL)

        continuesection.Add(time_sizer, -1, wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                            5)

        ratioval = [
            '50', '75', '100', '125', '150', '175', '200', '300', '400', '500'
        ]
        self.cbratio = wx.ComboBox(self, -1, "", wx.Point(-1, -1),
                                   wx.Size(45, -1), ratioval,
                                   wx.CB_DROPDOWN | wx.CB_READONLY)

        percent_sizer = wx.BoxSizer(wx.HORIZONTAL)
        percent_sizer.Add(rb3, 0, wx.ALIGN_CENTER_VERTICAL)
        percent_sizer.Add(self.cbratio, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT,
                          5)
        percent_sizer.Add(wx.StaticText(self, -1, "%"), 0,
                          wx.ALIGN_CENTER_VERTICAL)

        continuesection.Add(percent_sizer, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        rightbox.Add(continuesection, 0, wx.EXPAND | wx.ALL, 5)

        self.timeoutbox = wx.CheckBox(self, -1,
                                      self.utility.lang.get('disabletimeout'))

        rightbox.Add(self.timeoutbox, 0, wx.EXPAND | wx.ALL, 10)

        leftrightbox.Add(leftbox)
        leftrightbox.Add(rightbox)
        outerbox.Add(leftrightbox)

        applybtn = wx.Button(self, -1, self.utility.lang.get('apply'))
        self.Bind(wx.EVT_BUTTON, self.onApply, applybtn)
        okbtn = wx.Button(self, -1, self.utility.lang.get('ok'))
        self.Bind(wx.EVT_BUTTON, self.onOK, okbtn)

        cancelbtn = wx.Button(self, wx.ID_CANCEL,
                              self.utility.lang.get('cancel'))

        setDefaultsbtn = wx.Button(self, -1,
                                   self.utility.lang.get('reverttodefault'))
        self.Bind(wx.EVT_BUTTON, self.RevertToDefault, setDefaultsbtn)

        buttonbox = wx.BoxSizer(wx.HORIZONTAL)
        buttonbox.Add(applybtn, 0, wx.ALL, 5)
        buttonbox.Add(okbtn, 0, wx.ALL, 5)
        buttonbox.Add(cancelbtn, 0, wx.ALL, 5)
        buttonbox.Add(setDefaultsbtn, 0, wx.ALL, 5)

        outerbox.Add(buttonbox, 0, wx.ALIGN_CENTER)

        self.setDefaults()

        self.SetAutoLayout(True)
        self.SetSizer(outerbox)
        self.Fit()
Example #5
0
    def __init__(self, parent, IDfamille=None):
        wx.Panel.__init__(self,
                          parent,
                          id=-1,
                          name="DLG_Famille_pieces",
                          style=wx.TAB_TRAVERSAL)
        self.parent = parent
        self.IDfamille = IDfamille

        # Pièces à fournir
        self.staticbox_pieces_obligatoires = wx.StaticBox(
            self, -1, _(u"Pièces à fournir"))
        self.ctrl_pieces_obligatoires = CTRL_Pieces_obligatoires.CTRL(
            self, IDfamille=IDfamille, size=(-1, 200))
        self.ctrl_pieces_obligatoires.SetMinSize((280, 100))
        couleur_fond = UTILS_Interface.GetValeur("couleur_tres_claire",
                                                 wx.Colour(240, 251, 237))
        self.ctrl_pieces_obligatoires.SetBackgroundColour(couleur_fond)

        # Pièces fournies
        self.staticbox_pieces = wx.StaticBox(self, -1, _(u"Pièces fournies"))
        self.ctrl_pieces = OL_Pieces.ListView(
            self,
            IDfamille=IDfamille,
            id=-1,
            name="OL_pieces",
            style=wx.LC_REPORT | wx.SUNKEN_BORDER | wx.LC_SINGLE_SEL)

        self.bouton_ajouter = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_modifier = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_supprimer = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"),
                      wx.BITMAP_TYPE_ANY))

        # Binds
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouter, self.bouton_ajouter)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonModifier, self.bouton_modifier)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer)

        # Propriétés
        self.bouton_ajouter.SetToolTip(
            wx.ToolTip(_(u"Cliquez ici pour saisir une pièce")))
        self.bouton_modifier.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour modifier la pièce sélectionnée")))
        self.bouton_supprimer.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour supprimer la pièce sélectionnée")))

        # --- Layout ---
        grid_sizer_base = wx.FlexGridSizer(rows=1, cols=2, vgap=0, hgap=0)

        # Pièces à fournir
        staticbox_pieces_obligatoires = wx.StaticBoxSizer(
            self.staticbox_pieces_obligatoires, wx.VERTICAL)
        grid_sizer_pieces_obligatoires = wx.FlexGridSizer(rows=1,
                                                          cols=2,
                                                          vgap=5,
                                                          hgap=5)
        grid_sizer_pieces_obligatoires.Add(self.ctrl_pieces_obligatoires, 1,
                                           wx.EXPAND, 0)
        grid_sizer_pieces_obligatoires.AddGrowableCol(0)
        grid_sizer_pieces_obligatoires.AddGrowableRow(0)
        staticbox_pieces_obligatoires.Add(grid_sizer_pieces_obligatoires, 1,
                                          wx.EXPAND | wx.ALL, 5)
        grid_sizer_base.Add(staticbox_pieces_obligatoires, 0,
                            wx.EXPAND | wx.ALL, 5)

        # Pièces à fournir
        staticbox_pieces = wx.StaticBoxSizer(self.staticbox_pieces,
                                             wx.VERTICAL)
        grid_sizer_pieces = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)
        grid_sizer_pieces.Add(self.ctrl_pieces, 1, wx.EXPAND, 0)
        grid_sizer_boutons = wx.FlexGridSizer(rows=3, cols=1, vgap=5, hgap=5)
        grid_sizer_boutons.Add(self.bouton_ajouter, 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_modifier, 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_supprimer, 0, wx.ALL, 0)
        grid_sizer_pieces.Add(grid_sizer_boutons, 1, wx.ALL, 0)
        grid_sizer_pieces.AddGrowableCol(0)
        grid_sizer_pieces.AddGrowableRow(0)
        staticbox_pieces.Add(grid_sizer_pieces, 1, wx.EXPAND | wx.ALL, 5)
        grid_sizer_base.Add(staticbox_pieces, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableCol(1)
        grid_sizer_base.AddGrowableRow(0)
        self.Layout()
Example #6
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.axes_point = self.figure.add_subplot(111)
        
        self.canvas = FigureCanvas(self, -1, self.figure)
        self.bSizer_main = wx.BoxSizer( wx.VERTICAL )
        self.bSizer_main.Add(self.canvas, 100, wx.LEFT | wx.TOP | wx.GROW)
        self.Fit()

        self.m_panel_btw = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel_btw.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
        self.bSizer_main.Add( self.m_panel_btw, 2, wx.EXPAND, 5 )

        self.bSizer_sub = wx.BoxSizer( wx.HORIZONTAL )
        
        self.sbSizer_x = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Pulslänge" ), wx.VERTICAL )
        self.sbSizer_x_sub= wx.BoxSizer( wx.HORIZONTAL )

        #Slider  Pulslänge------------------------------------------
        self.m_text_first = wx.StaticText( self.sbSizer_x.GetStaticBox(), wx.ID_ANY, u"1 ms", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_text_first.Wrap( -1 )
        self.sbSizer_x_sub.Add( self.m_text_first, 0, wx.ALL, 5 )
        
        self.m_slider_x = wx.Slider( self.sbSizer_x.GetStaticBox(), wx.ID_ANY, 10, 1, 500, wx.DefaultPosition, wx.Size( 200,-1 ), wx.SL_HORIZONTAL|wx.SIMPLE_BORDER )
        self.m_slider_x.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_MENU ) )
        self.m_slider_x.Bind(wx.EVT_SLIDER, self.OnSliderScroll_x)
    
        self.sbSizer_x_sub.Add( self.m_slider_x, 1, wx.ALL, 5 )

        self.m_text_last = wx.StaticText( self.sbSizer_x.GetStaticBox(), wx.ID_ANY, u"500 ms", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_text_first.Wrap( -1 )
        self.sbSizer_x_sub.Add( self.m_text_last, 0, wx.ALL, 5 )

        self.sbSizer_x.Add( self.sbSizer_x_sub, 0, wx.ALL, 5 )

        self.m_text_diff_slider_x = wx.StaticText( self.sbSizer_x.GetStaticBox(), wx.ID_ANY, u"10 ms", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_text_diff_slider_x.Wrap( -1 )
        self.sbSizer_x.Add( self.m_text_diff_slider_x, 1, wx.ALIGN_CENTER, 2)

        self.sbSizer_y = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Volumen/Puls" ), wx.VERTICAL )
        self.sbSizer_y_sub= wx.BoxSizer( wx.HORIZONTAL )

        #Slider Volumen------------------------------------------
        self.m_text_first_y = wx.StaticText( self.sbSizer_y.GetStaticBox(), wx.ID_ANY, u"6 µl", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_text_first.Wrap( -1 )
        self.sbSizer_y_sub.Add( self.m_text_first_y, 0, wx.ALL, 5 )
        
        self.m_slider_y = wx.Slider( self.sbSizer_y.GetStaticBox(), wx.ID_ANY, 13.2, 6, 500, wx.DefaultPosition, wx.Size( 200,-1 ),wx.SL_HORIZONTAL|wx.SIMPLE_BORDER )
        self.m_slider_y.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_MENU ) )
        self.m_slider_y.Bind(wx.EVT_SLIDER, self.OnSliderScroll_y)
        
        self.sbSizer_y_sub.Add( self.m_slider_y, 1, wx.ALL, 5 )

        self.m_text_last_y = wx.StaticText( self.sbSizer_y.GetStaticBox(), wx.ID_ANY, u"500 µl", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_text_first.Wrap( -1 )
        self.sbSizer_y_sub.Add( self.m_text_last_y, 0, wx.ALL, 5 )

        self.sbSizer_y.Add( self.sbSizer_y_sub, 0, wx.ALL, 5 )

        self.m_text_diff_slider_y = wx.StaticText( self.sbSizer_y.GetStaticBox(), wx.ID_ANY, u"13.2 µl", wx.DefaultPosition, wx.DefaultSize, 0 )
        self.m_text_diff_slider_y.Wrap( -1 )
        self.sbSizer_y.Add( self.m_text_diff_slider_y, 1, wx.ALIGN_CENTER, 2)
        
        self.m_sdbSizer_dialog = wx.StdDialogButtonSizer()
        self.m_sdbSizerOK = wx.Button( self, wx.ID_OK, u"Übernehmen")
        self.m_sdbSizer_dialog.AddButton( self.m_sdbSizerOK )
        self.m_sdbSizer_Cancel = wx.Button( self, wx.ID_CANCEL, u"Schließen" )
        self.m_sdbSizer_dialog.AddButton( self.m_sdbSizer_Cancel )
        self.m_sdbSizer_dialog.Realize();

        self.m_panel_left = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel_left.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
        self.m_panel_left.SetMaxSize( wx.Size( 1,-1 ) )

        self.m_panel_right = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel_right.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
        self.m_panel_right.SetMaxSize( wx.Size( 1,-1 ) )

        self.m_panel_right_right = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel_right_right.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
        self.m_panel_right_right.SetMaxSize( wx.Size( 1,-1 ) )
        
        self.m_panel_middle = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel_middle.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
        self.m_panel_middle.SetMaxSize( wx.Size( 10,-1 ) )

        self.bSizer_sub.Add( self.m_panel_left,1, wx.EXPAND |wx.ALL, 5 )
        self.bSizer_sub.Add( self.sbSizer_x, 1,wx.EXPAND, 5 )
        self.bSizer_sub.Add( self.m_panel_middle, 1,wx.EXPAND, 5 )
        self.bSizer_sub.Add( self.sbSizer_y, 1,wx.EXPAND, 5 )
        self.bSizer_sub.Add( self.m_panel_right,1, wx.EXPAND |wx.ALL, 5 )
        self.bSizer_sub.Add( self.m_sdbSizer_dialog,1, wx.EXPAND |wx.ALL, 5 )
        self.bSizer_sub.Add( self.m_panel_right_right,1, wx.EXPAND |wx.ALL, 5 )
        
        self.bSizer_main.Add( self.bSizer_sub, 1, wx.EXPAND, 5 )
        self.m_panel_down = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
        self.m_panel_down.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
        self.bSizer_main.Add( self.m_panel_down, 2, wx.EXPAND, 5 )
        
        self.SetSizer( self.bSizer_main )
        self.Layout()
        
        self.Centre( wx.BOTH )
Example #7
0
    def InitAdvancedControls(self, dialog):
        """Initialize controls for advanced options dialog"""

        # Create legend box
        legendBox = wx.StaticBox(dialog, -1, "Legend")
        legendBoxSizer = wx.StaticBoxSizer(legendBox, wx.VERTICAL)
        legendGridSizer = wx.FlexGridSizer(rows=len(self.figure.axes) + 1,
                                           cols=7,
                                           vgap=3,
                                           hgap=3)
        rbtn1 = wx.RadioButton(dialog, -1, "No Legend", style=wx.RB_GROUP)
        rbtn2 = wx.RadioButton(dialog, -1, "Legend")
        rbtn1.SetValue(True)
        legendGridSizer.AddMany([
            (wx.StaticText(dialog, -1, ""), 0, wx.ALIGN_CENTER),
            (wx.StaticText(dialog, -1, "Transparency"), 0, wx.ALIGN_CENTER),
            (wx.StaticText(dialog, -1, "Location"), 0, wx.ALIGN_CENTER),
            (wx.StaticText(dialog, -1, "x"), 0, wx.ALIGN_CENTER),
            (wx.StaticText(dialog, -1, "y"), 0, wx.ALIGN_CENTER),
            (wx.StaticText(dialog, -1, "Pad"), 0, wx.ALIGN_CENTER),
            (wx.StaticText(dialog, -1, "Size"), 0, wx.ALIGN_CENTER)
        ])

        loc_list = [
            '(select)', 'upper right', 'upper left', 'lower left',
            'lower right', 'right', 'center left', 'center right',
            'lower center', 'upper center', 'center'
        ]

        #Create controls
        lineBoxes = []
        self.advanced_options = {'legendCtrls': [], 'lineCtrls': []}
        i = 1
        scrolls = []
        for axis in self.figure.axes:
            advscroll = wx.ScrolledWindow(dialog, -1)
            scrolls.append(advscroll)
            albl = wx.StaticText(dialog, -1, "Y%s-axis" % i)

            legend_props = {
                'alpha': 80,
                'loc_x': 0.0,
                'loc_y': 0.0,
                'pad': 0.4,
                'size': 14.0
            }

            if axis.get_legend() is not None:
                rbtn2.SetValue(True)
                legend = axis.get_legend()
                legend_props['alpha'] = (legend.get_frame().get_alpha()
                                         or 1.0) * 100

                # Normalize the legend coordinates
                # matplotlib 1.1.0 has location as 0-1 inside the graph frame
                # (0,0) is the lower left corner of the graph
                x0graph, y0graph, x1graph, y1graph = axis.get_frame(
                ).get_extents().bounds
                x0lgd, y0lgd, _, _ = legend.get_frame().get_extents().bounds
                legend_props['loc_x'] = round((x0lgd - x0graph) / (x1graph), 5)
                legend_props['loc_y'] = round((y0lgd - y0graph) / (y1graph), 5)

                legend_props['pad'] = legend.borderpad
                legend_props['size'] = legend.get_texts()[0].get_fontsize()

            aalpha = wx.SpinCtrl(dialog,
                                 -1,
                                 style=wx.SP_ARROW_KEYS,
                                 min=0,
                                 max=100,
                                 initial=legend_props['alpha'],
                                 size=(75, -1))
            aloc = wx.Choice(dialog, -1, choices=loc_list)

            aloc_x = wx.TextCtrl(dialog,
                                 -1,
                                 str(legend_props['loc_x']),
                                 size=(75, -1))
            aloc_y = wx.TextCtrl(dialog,
                                 -1,
                                 str(legend_props['loc_y']),
                                 size=(75, -1))

            apad = wx.TextCtrl(dialog,
                               -1,
                               str(legend_props['pad']),
                               size=(75, -1))
            asize = wx.TextCtrl(dialog,
                                -1,
                                str(legend_props['size']),
                                size=(75, -1))

            legendGridSizer.AddMany([(albl, 0, wx.ALIGN_CENTER),
                                     (aalpha, 0, wx.ALIGN_CENTER),
                                     (aloc, 0, wx.ALIGN_CENTER),
                                     (aloc_x, 0, wx.ALIGN_CENTER),
                                     (aloc_y, 0, wx.ALIGN_CENTER),
                                     (apad, 0, wx.ALIGN_CENTER),
                                     (asize, 0, wx.ALIGN_CENTER)])
            self.advanced_options["legendCtrls"].append(
                (aalpha, (aloc, aloc_x, aloc_y), apad, asize))

            lineBox = wx.StaticBox(dialog, -1, "Y%s lines" % i)
            lineBoxSizer = wx.StaticBoxSizer(lineBox, wx.VERTICAL)
            lineGridSizer = wx.FlexGridSizer(rows=len(axis.lines) + 1,
                                             cols=4,
                                             vgap=3,
                                             hgap=3)
            lineGridSizer.AddMany([
                ((-1, -1), 0),
                (wx.StaticText(advscroll, -1,
                               "Transparency"), 0, wx.ALIGN_CENTER),
                (wx.StaticText(advscroll, -1, "Order"), 0, wx.ALIGN_CENTER),
                ((-1, -1), 0)
            ])
            i += 1
            for line in axis.lines:
                lbltxt = line.get_label()
                if len(lbltxt) > 40:
                    lbltxt = line.get_label()[:37] + "..."
                lbl = wx.StaticText(advscroll,
                                    -1,
                                    lbltxt,
                                    style=wx.ALIGN_RIGHT | wx.ST_NO_AUTORESIZE)
                alphabox = wx.SpinCtrl(advscroll,
                                       -1,
                                       style=wx.SP_ARROW_KEYS,
                                       min=0,
                                       max=100,
                                       initial=(line.get_alpha() or 1.0) * 100,
                                       size=(75, -1))
                zorderbox = wx.TextCtrl(advscroll,
                                        -1,
                                        str(line.get_zorder()),
                                        size=(30, -1))
                lineGridSizer.AddMany([(lbl, 0, wx.ALIGN_RIGHT | wx.EXPAND),
                                       (alphabox, 0, wx.ALIGN_CENTER),
                                       (zorderbox, 0, wx.ALIGN_CENTER),
                                       ((-1, -1), 0)])
                self.advanced_options["lineCtrls"].append(
                    (alphabox, zorderbox))

            lineGridSizer.AddGrowableCol(0)
            lineGridSizer.AddGrowableCol(3)
            advscroll.SetSizer(lineGridSizer)
            lineBoxSizer.Add(advscroll, 1, wx.EXPAND | wx.ALL)
            lineBoxes.append(lineBoxSizer)

        legendBoxSizer.AddMany([(rbtn1, 0, wx.EXPAND), (rbtn2, 0, wx.EXPAND),
                                (legendGridSizer, 0, wx.EXPAND | wx.ALL)])
        self.advanced_options["legendCtrls"].append((rbtn1, rbtn2))

        updateBtn = wx.Button(dialog, wx.ID_OK, "OK")
        cancelBtn = wx.Button(dialog, wx.ID_CANCEL, "Cancel")
        dialog.Bind(wx.EVT_BUTTON, self.OnAdvancedUpdate, updateBtn)

        controlSizer = wx.BoxSizer(wx.HORIZONTAL)
        controlSizer.AddMany([(updateBtn, 1, wx.EXPAND),
                              (cancelBtn, 1, wx.EXPAND)])

        # Place controls
        boxSizer = wx.BoxSizer(wx.VERTICAL)
        boxSizer.Add(legendBoxSizer, 0, wx.EXPAND | wx.ALL)
        for linebox in lineBoxes:
            boxSizer.Add(linebox, 1, wx.EXPAND | wx.ALL)
        boxSizer.Add(controlSizer, 0, wx.EXPAND | wx.ALL)

        totalHeight = legendBoxSizer.GetMinSize().GetHeight(
        ) + controlSizer.GetMinSize().GetHeight()

        for advscroll in scrolls:
            width = advscroll.GetBestSize().width
            height = min(advscroll.GetBestSize().height, 250) + 25
            advscroll.SetScrollbars(0, 10, 1, 1)
            totalHeight += height

        boxSizer.SetMinSize((width, totalHeight))
        dialog.SetSizer(boxSizer)
        dialog.SetAutoLayout(1)
        dialog.Fit()
    def __init__(self, parent,gui_size,cfg):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)

        # variable initilization
        self.method = "automatic"
        self.config = cfg
        # design the panel
        self.sizer = wx.GridBagSizer(5, 5)

        text = wx.StaticText(self, label="DeepLabCut - Step 4. Create training dataset")
        self.sizer.Add(text, pos=(0, 0), flag=wx.TOP|wx.LEFT|wx.BOTTOM,border=15)
        # Add logo of DLC
        icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(logo))
        self.sizer.Add(icon, pos=(0, 4), flag=wx.TOP|wx.RIGHT|wx.ALIGN_RIGHT,border=5)

        line1 = wx.StaticLine(self)
        self.sizer.Add(line1, pos=(1, 0), span=(1, 5),flag=wx.EXPAND|wx.BOTTOM, border=10)

        self.cfg_text = wx.StaticText(self, label="Select the config file")
        self.sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP|wx.LEFT, border=5)

        if sys.platform=='darwin':
            self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="*.yaml")
        else:
            self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
        # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml")
        self.sizer.Add(self.sel_config, pos=(2, 1),span=(1,3),flag=wx.TOP|wx.EXPAND, border=5)
        self.sel_config.SetPath(self.config)
        self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config)

        sb = wx.StaticBox(self, label="Optional Attributes")
        boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)

        self.hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox3 = wx.BoxSizer(wx.HORIZONTAL)

        net_text = wx.StaticBox(self, label="Select the network")
        netboxsizer = wx.StaticBoxSizer(net_text, wx.VERTICAL)
        self.net_choice = wx.ComboBox(self, style=wx.CB_READONLY)
        options = ['resnet_50', 'resnet_101','resnet_152','mobilenet_v2_1.0','mobilenet_v2_0.75','mobilenet_v2_0.5','mobilenet_v2_0.35']
        self.net_choice.Set(options)
        self.net_choice.SetValue('resnet_50')
        netboxsizer.Add(self.net_choice,20, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        aug_text = wx.StaticBox(self, label="Select the augmentation method")
        augboxsizer = wx.StaticBoxSizer(aug_text, wx.VERTICAL)
        self.aug_choice = wx.ComboBox(self, style=wx.CB_READONLY)
        options = ['default', 'tensorpack','imgaug']
        self.aug_choice.Set(options)
        self.aug_choice.SetValue('default')
        augboxsizer.Add(self.aug_choice,20, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        shuffle_text = wx.StaticBox(self, label="Or set a specific shuffle indx (1 network only)")
        shuffle_text_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL)
        self.shuffle = wx.SpinCtrl(self, value='1',min=1,max=100)
        shuffle_text_boxsizer.Add(self.shuffle,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        trainingindex_box = wx.StaticBox(self, label="Specify the trainingset index")
        trainingindex_boxsizer = wx.StaticBoxSizer(trainingindex_box, wx.VERTICAL)
        self.trainingindex = wx.SpinCtrl(self, value='0',min=0,max=100)
        trainingindex_boxsizer.Add(self.trainingindex,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)


        self.userfeedback = wx.RadioBox(self, label='Need user feedback?', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
        self.userfeedback.SetSelection(1)

        self.hbox1.Add(netboxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox1.Add(augboxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)

        self.hbox2.Add(shuffle_text_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox2.Add(trainingindex_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox2.Add(self.userfeedback,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)


        self.model_comparison_choice = wx.RadioBox(self, label='Want to compare models?', choices=['Yes', 'No'],majorDimension=1, style=wx.RA_SPECIFY_COLS)
        self.model_comparison_choice.Bind(wx.EVT_RADIOBOX,self.chooseOption)
        self.model_comparison_choice.SetSelection(1)

        self.shuffles_text = wx.StaticBox(self, label="Specify the number of shuffles")
        self.shuffles_text_boxsizer = wx.StaticBoxSizer(self.shuffles_text, wx.VERTICAL)
        self.shuffles = wx.SpinCtrl(self, value='1',min=1,max=100)
        self.shuffles_text_boxsizer.Add(self.shuffles,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        networks = ['resnet_50', 'resnet_101', 'resnet_152', 'mobilenet_v2_1.0','mobilenet_v2_0.75', 'mobilenet_v2_0.5', 'mobilenet_v2_0.35']
        augmentation_methods = ['default','tensorpack','imgaug']
        self.network_box = wx.StaticBox(self, label="Select the networks")
        self.network_boxsizer = wx.StaticBoxSizer(self.network_box, wx.VERTICAL)
        self.networks_to_compare = wx.CheckListBox(self, choices=networks, style=0,name = "Select the networks")
        self.networks_to_compare.Bind(wx.EVT_CHECKLISTBOX,self.get_network_names)
        self.network_boxsizer.Add(self.networks_to_compare,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.augmentation_box = wx.StaticBox(self, label="Select the augmentation methods")
        self.augmentation_boxsizer = wx.StaticBoxSizer(self.augmentation_box, wx.VERTICAL)
        self.augmentation_to_compare = wx.CheckListBox(self, choices=augmentation_methods, style=0,name = "Select the augmentation methods")
        self.augmentation_to_compare.Bind(wx.EVT_CHECKLISTBOX,self.get_augmentation_method_names)
        self.augmentation_boxsizer.Add(self.augmentation_to_compare,1, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.hbox3.Add(self.model_comparison_choice,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox3.Add(self.shuffles_text_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox3.Add(self.network_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        self.hbox3.Add(self.augmentation_boxsizer,10, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)

        self.shuffles_text.Hide()
        self.shuffles.Hide()
        self.network_box.Hide()
        self.networks_to_compare.Hide()
        self.augmentation_box.Hide()
        self.augmentation_to_compare.Hide()

        boxsizer.Add(self.hbox1,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)
        boxsizer.Add(self.hbox2,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)
        boxsizer.Add(self.hbox3,0, wx.EXPAND|wx.TOP|wx.BOTTOM, 10)

        self.sizer.Add(boxsizer, pos=(3, 0), span=(1, 5),flag=wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT , border=10)

        self.help_button = wx.Button(self, label='Help')
        self.sizer.Add(self.help_button, pos=(4, 0), flag=wx.LEFT, border=10)
        self.help_button.Bind(wx.EVT_BUTTON, self.help_function)

        self.ok = wx.Button(self, label="Ok")
        self.sizer.Add(self.ok, pos=(4, 4))
        self.ok.Bind(wx.EVT_BUTTON, self.create_training_dataset)

        self.reset = wx.Button(self, label="Reset")
        self.sizer.Add(self.reset, pos=(4, 1), span=(1, 1),flag=wx.BOTTOM|wx.RIGHT, border=10)
        self.reset.Bind(wx.EVT_BUTTON, self.reset_create_training_dataset)

        self.sizer.AddGrowableCol(2)

        self.SetSizer(self.sizer)
        self.sizer.Fit(self)
        self.Layout()
Example #9
0
    def __DoLayout(self):
        """Layout the controls"""
        msizer = wx.BoxSizer(wx.VERTICAL)

        lsizer = wx.BoxSizer(wx.HORIZONTAL)
        ftype = wx.GetApp().GetCurrentBuffer().GetLangId()
        ftype = handlers.GetHandlerById(ftype).GetName()
        htypes = GetHandlerTypes()
        lang_ch = wx.Choice(self, ID_LANGUAGE, choices=htypes)
        if ftype != handlers.DEFAULT_HANDLER:
            lang_ch.SetStringSelection(ftype)
        else:
            lang_ch.SetStringSelection(htypes[0])

        lsizer.AddMany([(wx.StaticText(self, label=_("File Type") + ":"), 0,
                         wx.ALIGN_CENTER_VERTICAL), ((5, 5), 0),
                        (lang_ch, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL)])

        # Main area
        sbox = wx.StaticBox(self, label=_("Executables"))
        boxsz = wx.StaticBoxSizer(sbox, wx.VERTICAL)

        # Default exe
        dsizer = wx.BoxSizer(wx.HORIZONTAL)
        chandler = handlers.GetHandlerByName(lang_ch.GetStringSelection())
        cmds = chandler.GetAliases()
        def_ch = wx.Choice(self, wx.ID_DEFAULT, choices=cmds)
        if chandler.GetName() != handlers.DEFAULT_HANDLER:
            def_ch.SetStringSelection(chandler.GetDefault())
        elif len(cmds):
            def_ch.SetStringSelection(cmds[0])
        else:
            pass

        dsizer.AddMany([(wx.StaticText(self, label=_("Default") + ":"), 0,
                         wx.ALIGN_CENTER_VERTICAL), ((5, 5), 0),
                        (def_ch, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL)])

        # Executables List
        exelist = CommandListCtrl(self, ID_EXECUTABLES,
                                  style=wx.LC_EDIT_LABELS|\
                                        wx.BORDER|wx.LC_REPORT|\
                                        wx.LC_SINGLE_SEL)
#        exelist.SetToolTipString(_("Click on an item to edit"))
#        exelist.InsertColumn(0, _("Alias"))
#        exelist.InsertColumn(1, _("Executable Commands"))
        self.SetListItems(chandler.GetCommands())
        addbtn = wx.BitmapButton(self, wx.ID_ADD, GetPlusBitmap())
        addbtn.SetToolTipString(_("Add a new executable"))
        delbtn = wx.BitmapButton(self, wx.ID_REMOVE, GetMinusBitmap())
        delbtn.SetToolTipString(_("Remove selection from list"))
        btnsz = wx.BoxSizer(wx.HORIZONTAL)
        btnsz.AddMany([(addbtn, 0), ((2, 2), 0), (delbtn, 0)])

        # Box Sizer Layout
        boxsz.AddMany([((5, 5), 0), (dsizer, 0, wx.ALIGN_CENTER|wx.EXPAND),
                       ((5, 5), 0), (wx.StaticLine(self), 0, wx.EXPAND),
                       ((8, 8), 0), (exelist, 1, wx.EXPAND), ((5, 5), 0),
                       (btnsz, 0, wx.ALIGN_LEFT)])

        # Setup the main sizer
        msizer.AddMany([((10, 10), 0), (lsizer, 0, wx.EXPAND),
                        ((10, 10), 0), (wx.StaticLine(self), 0, wx.EXPAND),
                        ((10, 10), 0),
                        (boxsz, 1, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL),
                        ((10, 10), 0)])

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.AddMany([((8, 8), 0), (msizer, 1, wx.EXPAND), ((8, 8), 0)])
        self.SetSizer(hsizer)
        self.SetAutoLayout(True)
Example #10
0
    def initialize_interface(self, massaxis, chargeaxis, igrid, config, pks):
        """
        Initialize the parameters, setup the GUI, and plot the intial results.
        :param massaxis: Mass axis values
        :param chargeaxis: Charge axis value
        :param igrid: Intensities at each mass and charge point
        :param config: UniDecConfig object
        :param pks: Peaks object
        :return: None
        """
        # Initialize the parameters
        self.config = config
        self.pks = pks

        self.massaxis = np.array(massaxis)
        self.chargeaxis = np.array(chargeaxis)
        self.igrid = np.reshape(igrid, (len(massaxis), len(chargeaxis)))

        # Setup the GUI
        pnl = wx.Panel(self)
        vbox = wx.BoxSizer(wx.VERTICAL)

        sb = wx.StaticBox(pnl, label='Set Parameters to Plot Native Z')
        sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)

        self.plot1 = plot1d.Plot1d(pnl, figsize=self.figsize)
        self.plot2 = plot1d.Plot1d(pnl, figsize=self.figsize)
        self.plot3 = plot1d.Plot1d(pnl, figsize=self.figsize)
        self.plot4 = plot1d.Plot1d(pnl, figsize=self.figsize)
        self.plot5 = plot1d.Plot1d(pnl, figsize=self.figsize)
        self.plot6 = plot1d.Plot1d(pnl, figsize=self.figsize)
        self.plot7 = plot2d.Plot2d(pnl, figsize=self.figsize)

        hbox0 = wx.BoxSizer(wx.HORIZONTAL)
        hbox0.Add(self.plot1, 0, wx.EXPAND)
        hbox0.Add(self.plot3, 0, wx.EXPAND)
        hbox0.Add(self.plot4, 0, wx.EXPAND)

        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2.Add(self.plot2, 0, wx.EXPAND)
        hbox2.Add(self.plot5, 0, wx.EXPAND)
        hbox2.Add(self.plot6, 0, wx.EXPAND)

        sbs.Add(hbox0, 0, wx.EXPAND)
        sbs.Add(hbox2, 0, wx.EXPAND)

        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        addbutton = wx.Button(pnl, label="Add Line")
        fitbutton = wx.Button(pnl, label="Fit")
        resetbutton = wx.Button(pnl, label="Reset to Default")
        extractbutton = wx.Button(pnl, label="Extract")
        self.ctlmassoffset = wx.TextCtrl(pnl,
                                         value=str(self.config.massoffset),
                                         size=(50, -1))
        self.ctlfilt = wx.RadioBox(pnl,
                                   label="Extract Shape",
                                   choices=["Box", "Gaussian"])
        self.ctlfilt.SetSelection(self.config.extractshape)
        savefigbutton = wx.Button(pnl, label="Save Figures")
        replotbutton = wx.Button(pnl, label="Replot")
        hbox1.Add(addbutton, 0)
        hbox1.Add(replotbutton, 0)
        hbox1.Add(resetbutton, 0)
        hbox1.Add(wx.StaticText(pnl, label="     "), 0,
                  wx.ALIGN_CENTER_VERTICAL)

        hbox1.Add(fitbutton, 0)
        hbox1.Add(extractbutton, 0)
        hbox1.Add(wx.StaticText(pnl, label="     Monomer Mass: "),
                  0)  # , wx.ALIGN_CENTER_VERTICAL)
        hbox1.Add(self.ctlmassoffset, 0)
        hbox1.Add(self.ctlfilt, 0)

        hbox1.Add(savefigbutton, 0)
        sbs.Add(hbox1, 0, wx.EXPAND)

        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        self.zlistctrl = ColorList(pnl)
        hbox3.Add(self.zlistctrl, 1, wx.EXPAND)
        hbox3.Add(self.plot7, 0, wx.EXPAND)
        sbs.Add(hbox3, 0, wx.EXPAND)

        pnl.SetSizer(sbs)

        hboxend = wx.BoxSizer(wx.HORIZONTAL)
        okbutton = wx.Button(self, label='Ok')
        closebutton = wx.Button(self, label='Cancel')
        hboxend.Add(okbutton)
        hboxend.Add(closebutton, flag=wx.LEFT, border=5)

        vbox.Add(pnl, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        vbox.Add(hboxend, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=10)

        self.SetSizer(vbox)
        self.Center()

        # Bind events
        self.zlistctrl.ultimateList.Bind(wx.EVT_BUTTON, self.on_delete)
        self.zlistctrl.ultimateList.Bind(wx.EVT_LIST_ITEM_DESELECTED,
                                         self.update)

        fitbutton.Bind(wx.EVT_BUTTON, self.fit)
        addbutton.Bind(wx.EVT_BUTTON, self.on_add)
        resetbutton.Bind(wx.EVT_BUTTON, self.on_reset)
        extractbutton.Bind(wx.EVT_BUTTON, self.extract)
        savefigbutton.Bind(wx.EVT_BUTTON, self.save_figures)
        replotbutton.Bind(wx.EVT_BUTTON, self.on_replot)
        okbutton.Bind(wx.EVT_BUTTON, self.on_close)
        closebutton.Bind(wx.EVT_BUTTON, self.on_close_cancel)

        # Set Range Here and plot the initial results
        tstart = time.perf_counter()
        self.make_f_array(-50, 15)
        tend = time.perf_counter()
        print("F Array Time: %.2gs" % (tend - tstart))
        if self.config.zoffs == []:
            self.get_maxima()
        else:
            self.zoffs = self.config.zoffs
            self.plot_zoffs()
        self.populate_list(0)
Example #11
0
 def __do_layout(self):
     # begin wxGlade: AddinMakerWindow.__do_layout
     full_window_sizer = wx.BoxSizer(wx.HORIZONTAL)
     main_sizer = wx.BoxSizer(wx.VERTICAL)
     bottom_buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
     content_sizer = wx.BoxSizer(wx.HORIZONTAL)
     splitter_sizer = wx.BoxSizer(wx.HORIZONTAL)
     items_sizer = wx.BoxSizer(wx.HORIZONTAL)
     item_property_sizer = wx.BoxSizer(wx.VERTICAL)
     fields_sizer = wx.BoxSizer(wx.VERTICAL)
     properties_rows_holder = wx.StaticBoxSizer(
         self.properties_rows_holder_staticbox, wx.VERTICAL)
     project_bitmap_display_sizer = wx.BoxSizer(wx.HORIZONTAL)
     properties_rows = wx.BoxSizer(wx.VERTICAL)
     project_image_sizer = wx.BoxSizer(wx.HORIZONTAL)
     project_author_sizer = wx.BoxSizer(wx.HORIZONTAL)
     project_description_sizer = wx.BoxSizer(wx.HORIZONTAL)
     project_company_sizer = wx.BoxSizer(wx.HORIZONTAL)
     project_version_sizer = wx.BoxSizer(wx.HORIZONTAL)
     project_name_sizer = wx.BoxSizer(wx.HORIZONTAL)
     product_sizer = wx.BoxSizer(wx.HORIZONTAL)
     folder_sizer = wx.BoxSizer(wx.HORIZONTAL)
     logo_sizer = wx.BoxSizer(wx.HORIZONTAL)
     title_sizer = wx.BoxSizer(wx.HORIZONTAL)
     title_sizer.Add(self.title_label, 0,
                     wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_HORIZONTAL,
                     8)
     self.title_panel.SetSizer(title_sizer)
     main_sizer.Add(self.title_panel, 0, wx.EXPAND | wx.ALIGN_RIGHT, 0)
     main_sizer.Add(self.title_divider_line, 0, wx.EXPAND, 0)
     logo_sizer.Add(self.logo_bitmap, 0, wx.TOP, 8)
     self.logo_panel.SetSizer(logo_sizer)
     splitter_sizer.Add(self.logo_panel, 0, wx.EXPAND, 0)
     folder_sizer.Add(self.folder_label, 0, wx.ALIGN_CENTER_VERTICAL, 8)
     folder_sizer.Add(self.folder_button, 1, wx.EXPAND, 8)
     fields_sizer.Add(folder_sizer, 0, wx.ALL | wx.EXPAND, 4)
     product_sizer.Add(self.product_label, 0, wx.ALIGN_CENTER_VERTICAL, 3)
     product_sizer.Add(self.product_combo_box, 0, 0, 3)
     fields_sizer.Add(product_sizer, 0, wx.ALL | wx.EXPAND, 4)
     fields_sizer.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 8)
     project_name_sizer.Add(
         self.project_name_label, 0,
         wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)
     project_name_sizer.Add(self.project_name, 1, wx.EXPAND, 0)
     properties_rows.Add(project_name_sizer, 1, wx.EXPAND, 0)
     project_version_sizer.Add(
         self.project_version_label, 0,
         wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)
     project_version_sizer.Add(self.project_version, 1, wx.EXPAND, 0)
     properties_rows.Add(project_version_sizer, 1, wx.EXPAND, 0)
     project_company_sizer.Add(
         self.project_company_label, 0,
         wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)
     project_company_sizer.Add(self.project_company, 1, wx.EXPAND, 0)
     properties_rows.Add(project_company_sizer, 1, wx.EXPAND, 0)
     project_description_sizer.Add(
         self.project_description_label, 0,
         wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)
     project_description_sizer.Add(self.project_description, 1, wx.EXPAND,
                                   0)
     properties_rows.Add(project_description_sizer, 1, wx.EXPAND, 0)
     project_author_sizer.Add(
         self.project_author_label, 0,
         wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)
     project_author_sizer.Add(self.project_author, 1, wx.EXPAND, 0)
     properties_rows.Add(project_author_sizer, 1, wx.EXPAND, 0)
     properties_rows.Add(self.image_section_divider, 0, wx.ALL | wx.EXPAND,
                         2)
     project_image_sizer.Add(
         self.project_image_label, 0,
         wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)
     project_image_sizer.Add(self.select_project_image, 0, 0, 0)
     properties_rows.Add(project_image_sizer, 1, wx.EXPAND, 3)
     properties_rows_holder.Add(properties_rows, 0, wx.EXPAND, 0)
     project_bitmap_display_sizer.Add(self.icon_bitmap, 0, wx.TOP, 3)
     properties_rows_holder.Add(project_bitmap_display_sizer, 1,
                                wx.LEFT | wx.EXPAND, 80)
     fields_sizer.Add(properties_rows_holder, 0, wx.EXPAND, 0)
     self.project_settings_pane.SetSizer(fields_sizer)
     items_sizer.Add(self.contents_tree, 0, wx.EXPAND, 0)
     self.item_property_panel.SetSizer(item_property_sizer)
     items_sizer.Add(self.item_property_panel, 1, wx.EXPAND, 0)
     self.project_items_pane.SetSizer(items_sizer)
     self.tabs_notebook.AddPage(self.project_settings_pane,
                                "Project Settings")
     self.tabs_notebook.AddPage(self.project_items_pane, "Add-In Contents")
     splitter_sizer.Add(self.tabs_notebook, 1, wx.EXPAND, 4)
     content_sizer.Add(splitter_sizer, 1, wx.EXPAND, 4)
     self.propsheet_panel.SetSizer(content_sizer)
     main_sizer.Add(self.propsheet_panel, 1, wx.EXPAND, 0)
     bottom_buttons_sizer.Add(self.bottom_buttons_spacer_panel, 1,
                              wx.EXPAND, 0)
     bottom_buttons_sizer.Add(self.open_folder, 0, wx.ALL, 2)
     bottom_buttons_sizer.Add(self.save_button, 0, wx.ALL, 2)
     self.bottom_buttons_pane.SetSizer(bottom_buttons_sizer)
     main_sizer.Add(self.bottom_buttons_pane, 0, wx.EXPAND, 4)
     self.full_app_panel.SetSizer(main_sizer)
     full_window_sizer.Add(self.full_app_panel, 1, wx.ALL | wx.EXPAND, 1)
     self.SetSizer(full_window_sizer)
     full_window_sizer.Fit(self)
     self.Layout()
     self.Centre()
    def __do_layout(self):
        grid_sizer_base = wx.FlexGridSizer(rows=5, cols=1, vgap=10, hgap=10)
        grid_sizer_base.Add(self.ctrl_bandeau, 0, wx.EXPAND, 0)

        grid_sizer_contenu = wx.FlexGridSizer(rows=5, cols=1, vgap=10, hgap=10)

        # Nom
        box_nom = wx.StaticBoxSizer(self.box_nom_staticbox, wx.VERTICAL)
        box_nom.Add(self.ctrl_nom, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
        grid_sizer_contenu.Add(box_nom, 1, wx.EXPAND, 0)

        # Introduction
        box_intro = wx.StaticBoxSizer(self.box_intro_staticbox, wx.VERTICAL)
        box_intro.Add(self.ctrl_intro, 0, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 10)
        grid_sizer_contenu.Add(box_intro, 1, wx.EXPAND, 0)

        # Période
        box_periode = wx.StaticBoxSizer(self.box_periode_staticbox, wx.VERTICAL)

        grid_sizer_periode = wx.FlexGridSizer(rows=1, cols=5, vgap=10, hgap=10)
        grid_sizer_periode.Add(self.label_date_debut, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_periode.Add(self.ctrl_date_debut, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_periode.Add(self.label_date_fin, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_periode.Add(self.ctrl_date_fin, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        box_periode.Add(grid_sizer_periode, 1, wx.ALL | wx.EXPAND, 10)

        grid_sizer_contenu.Add(box_periode, 0, wx.EXPAND, 0)

        # Affichage
        box_affichage = wx.StaticBoxSizer(self.box_affichage_staticbox, wx.VERTICAL)

        grid_sizer_affichage = wx.FlexGridSizer(rows=4, cols=1, vgap=5, hgap=5)
        grid_sizer_affichage.Add(self.radio_oui, 0, wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_affichage.Add(self.radio_dates, 0, wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_affichage_periode = wx.FlexGridSizer(rows=1, cols=7, vgap=5, hgap=5)
        grid_sizer_affichage_periode.Add(self.label_affichage_date_debut, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage_periode.Add(self.ctrl_affichage_date_debut, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage_periode.Add(self.ctrl_affichage_heure_debut, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage_periode.Add(self.label_affichage_date_fin, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage_periode.Add(self.ctrl_affichage_date_fin, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage_periode.Add(self.ctrl_affichage_heure_fin, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage.Add(grid_sizer_affichage_periode, 0, wx.EXPAND | wx.LEFT, 16)

        grid_sizer_affichage.Add(self.radio_non, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_affichage.AddGrowableCol(0)

        box_affichage.Add(grid_sizer_affichage, 1, wx.ALL | wx.EXPAND, 10)
        grid_sizer_contenu.Add(box_affichage, 1,wx.EXPAND, 0)

        # Modèle d'Email
        box_modele = wx.StaticBoxSizer(self.box_modele_staticbox, wx.VERTICAL)

        grid_sizer_modele = wx.FlexGridSizer(rows=3, cols=1, vgap=5, hgap=5)
        grid_sizer_modele.Add(self.radio_modele_defaut, 0, wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_modele.Add(self.radio_modele_choix, 0, wx.ALIGN_CENTER_VERTICAL, 0)

        grid_sizer_modele_choix = wx.FlexGridSizer(rows=1, cols=7, vgap=5, hgap=5)
        grid_sizer_modele_choix.Add(self.ctrl_modele_email, 0, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_modele_choix.Add(self.bouton_gestion_modeles, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_modele_choix.AddGrowableCol(0)
        grid_sizer_modele.Add(grid_sizer_modele_choix, 0, wx.EXPAND | wx.LEFT, 16)

        grid_sizer_modele.AddGrowableCol(0)

        box_modele.Add(grid_sizer_modele, 1, wx.ALL | wx.EXPAND, 10)
        grid_sizer_contenu.Add(box_modele, 1,wx.EXPAND, 0)

        grid_sizer_contenu.AddGrowableCol(0)
        grid_sizer_base.Add(grid_sizer_contenu, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 10)
        
        # Boutons
        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10)
        grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0)
        grid_sizer_boutons.Add((20, 20), 0, wx.EXPAND, 0)
        grid_sizer_boutons.Add(self.bouton_ok, 0, 0, 0)
        grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_boutons, 1, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 10)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableCol(0)
        self.Layout()
        self.CenterOnScreen() 
Example #13
0
    def initialize(self):
        leginon.gui.wx.Settings.ScrolledDialog.initialize(self)
        sb = wx.StaticBox(self, -1, 'Spacing/Angle Calculator')
        sbszauto = wx.StaticBoxSizer(sb, wx.VERTICAL)

        szoptions = wx.GridBagSizer(5, 5)

        ## auto raster
        self.widgets['raster preset'] = PresetChoice(self, -1)
        presets = self.node.presetsclient.getPresetNames()
        self.widgets['raster preset'].setChoices(presets)
        self.widgets['raster overlap'] = FloatEntry(self, -1, chars=8)
        movetypes = self.node.calclients.keys()
        self.widgets['raster movetype'] = Choice(self, -1, choices=movetypes)
        self.autobut = wx.Button(
            self, -1,
            'Calculate spacing and angle using the following parameters:')

        szauto = wx.GridBagSizer(5, 5)
        szauto.Add(self.autobut, (0, 0), (1, 2), wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'Raster Preset')
        szauto.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szauto.Add(self.widgets['raster preset'], (1, 1), (1, 1),
                   wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'Overlap percent')
        szauto.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szauto.Add(self.widgets['raster overlap'], (2, 1), (1, 1),
                   wx.ALIGN_CENTER_VERTICAL)
        label = wx.StaticText(self, -1, 'Move Type')
        szauto.Add(label, (3, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szauto.Add(self.widgets['raster movetype'], (3, 1), (1, 1),
                   wx.ALIGN_CENTER_VERTICAL)
        sbszauto.Add(szauto, 1, wx.EXPAND | wx.ALL, 5)

        self.Bind(wx.EVT_BUTTON, self.onAutoButton, self.autobut)
        ## end of auto raster

        szoptions.Add(sbszauto, (0, 0), (1, 2), wx.ALIGN_CENTER_VERTICAL)

        label = wx.StaticText(self, -1, 'Raster Spacing')
        self.widgets['raster spacing'] = FloatEntry(self, -1, chars=8)
        szoptions.Add(label, (1, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szoptions.Add(self.widgets['raster spacing'], (1, 1), (1, 1),
                      wx.ALIGN_CENTER_VERTICAL)

        label = wx.StaticText(self, -1, 'Raster Angle')
        self.widgets['raster angle'] = FloatEntry(self, -1, chars=8)
        szoptions.Add(label, (2, 0), (1, 1), wx.ALIGN_CENTER_VERTICAL)
        szoptions.Add(self.widgets['raster angle'], (2, 1), (1, 1),
                      wx.ALIGN_CENTER_VERTICAL)

        szbutton = wx.GridBagSizer(5, 5)

        self.bclear = wx.Button(self, -1, 'Clear Targets')
        szbutton.Add(self.bclear, (0, 0), (1, 1),
                     wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
        szbutton.AddGrowableCol(0)

        self.Bind(wx.EVT_BUTTON, self.onClearButton, self.bclear)

        self.btest = wx.Button(self, -1, 'Test')
        szbutton.Add(self.btest, (0, 1), (1, 1),
                     wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        szbutton.AddGrowableCol(1)

        self.Bind(wx.EVT_BUTTON, self.onTestButton, self.btest)

        return [szoptions, szbutton]
Example #14
0
    def __init__(self, parent, IDfamille=None):
        wx.Panel.__init__(self,
                          parent,
                          id=-1,
                          name="panel_prestations",
                          style=wx.TAB_TRAVERSAL)
        self.parent = parent
        self.IDfamille = IDfamille

        self.staticbox_prestations = wx.StaticBox(self, -1, _(u"Prestations"))

        # OL Prestations
        self.listviewAvecFooter = OL_Prestations.ListviewAvecFooter(
            self, kwargs={"IDfamille": IDfamille})
        self.ctrl_prestations = self.listviewAvecFooter.GetListview()
        self.ctrl_recherche = OL_Prestations.CTRL_Outils(
            self, listview=self.ctrl_prestations, afficherCocher=True)
        self.ctrl_recherche.SetBackgroundColour((255, 255, 255))

        # Commandes boutons
        self.bouton_ajouter = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_modifier = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_supprimer = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_modele = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Magique.png"),
                      wx.BITMAP_TYPE_ANY))

        # Binds
        self.Bind(wx.EVT_BUTTON, self.ctrl_prestations.Ajouter,
                  self.bouton_ajouter)
        self.Bind(wx.EVT_BUTTON, self.ctrl_prestations.Modifier,
                  self.bouton_modifier)
        self.Bind(wx.EVT_BUTTON, self.ctrl_prestations.Supprimer,
                  self.bouton_supprimer)
        self.Bind(wx.EVT_BUTTON, self.ctrl_prestations.Appliquer_modele,
                  self.bouton_modele)

        # Propriétés
        self.bouton_ajouter.SetToolTip(
            wx.ToolTip(_(u"Cliquez ici pour saisir une prestation")))
        self.bouton_modifier.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour modifier la prestation sélectionnée")))
        self.bouton_supprimer.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour supprimer la prestation sélectionnée")))
        self.bouton_modele.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour saisir une prestation à partir d'un modèle de prestation"
                  )))

        # Layout
        grid_sizer_base = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)
        staticbox_prestations = wx.StaticBoxSizer(self.staticbox_prestations,
                                                  wx.VERTICAL)
        grid_sizer_prestations = wx.FlexGridSizer(rows=2,
                                                  cols=2,
                                                  vgap=5,
                                                  hgap=5)

        grid_sizer_prestations.Add(self.listviewAvecFooter, 1, wx.EXPAND, 0)

        grid_sizer_boutons = wx.FlexGridSizer(rows=5, cols=1, vgap=5, hgap=5)
        grid_sizer_boutons.Add(self.bouton_ajouter, 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_modifier, 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_supprimer, 0, wx.ALL, 0)
        grid_sizer_boutons.Add((10, 10), 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_modele, 0, wx.ALL, 0)
        grid_sizer_prestations.Add(grid_sizer_boutons, 1, wx.ALL, 0)

        grid_sizer_prestations.Add(self.ctrl_recherche, 0, wx.EXPAND | wx.ALL,
                                   0)

        grid_sizer_prestations.AddGrowableCol(0)
        grid_sizer_prestations.AddGrowableRow(0)
        staticbox_prestations.Add(grid_sizer_prestations, 1,
                                  wx.EXPAND | wx.ALL, 5)

        grid_sizer_base.Add(staticbox_prestations, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableCol(0)
        grid_sizer_base.AddGrowableRow(0)
Example #15
0
    def __do_layout(self):
        grid_sizer_base = wx.FlexGridSizer(rows=4, cols=1, vgap=10, hgap=10)

        # Bandeau
        grid_sizer_base.Add(self.ctrl_bandeau, 0, wx.EXPAND, 0)

        # Règlements
        staticbox_cotisations = wx.StaticBoxSizer(self.staticbox_cotisations,
                                                  wx.VERTICAL)
        grid_sizer_reglements = wx.FlexGridSizer(rows=1,
                                                 cols=2,
                                                 vgap=5,
                                                 hgap=5)

        grid_sizer_reglements.Add(self.ctrl_cotisations, 0, wx.EXPAND | wx.ALL,
                                  0)

        grid_sizer_reglements.AddGrowableRow(0)
        grid_sizer_reglements.AddGrowableCol(0)
        staticbox_cotisations.Add(grid_sizer_reglements, 1, wx.ALL | wx.EXPAND,
                                  5)
        grid_sizer_base.Add(staticbox_cotisations, 1,
                            wx.LEFT | wx.RIGHT | wx.EXPAND, 10)

        # Dépôts
        staticbox_depots = wx.StaticBoxSizer(self.staticbox_depots,
                                             wx.VERTICAL)
        grid_sizer_depots = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)

        grid_sizer_gauche = wx.FlexGridSizer(rows=3, cols=1, vgap=10, hgap=10)
        grid_sizer_gauche.Add(self.listviewAvecFooter, 0, wx.EXPAND, 0)
        grid_sizer_gauche.Add(self.ctrl_recherche, 0, wx.EXPAND, 0)
        grid_sizer_gauche.AddGrowableRow(0)
        grid_sizer_gauche.AddGrowableCol(0)
        grid_sizer_depots.Add(grid_sizer_gauche, 1, wx.EXPAND, 0)

        grid_sizer_droit = wx.FlexGridSizer(rows=5, cols=1, vgap=5, hgap=5)
        grid_sizer_droit.Add(self.bouton_ajouter, 0, 0, 0)
        grid_sizer_droit.Add(self.bouton_modifier, 0, 0, 0)
        grid_sizer_droit.Add(self.bouton_supprimer, 0, 0, 0)
        grid_sizer_droit.Add((10, 10), 0, 0, 0)
        grid_sizer_droit.Add(self.bouton_imprimer, 0, 0, 0)
        grid_sizer_depots.Add(grid_sizer_droit, 1, wx.EXPAND, 0)

        grid_sizer_depots.AddGrowableRow(0)
        grid_sizer_depots.AddGrowableCol(0)
        staticbox_depots.Add(grid_sizer_depots, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_base.Add(staticbox_depots, 1,
                            wx.LEFT | wx.RIGHT | wx.EXPAND, 10)

        # Boutons
        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10)
        grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0)
        grid_sizer_boutons.Add((20, 20), 0, wx.EXPAND, 0)
        grid_sizer_boutons.Add(self.bouton_fermer, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_boutons, 1,
                            wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 10)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableRow(2)
        grid_sizer_base.AddGrowableCol(0)
        self.Layout()
        self.CenterOnScreen()
Example #16
0
    def __DoLayout(self):
        """Layout the controls"""
        msizer = wx.BoxSizer(wx.VERTICAL)
        sbox = wx.StaticBox(self, label=_("Text Colors"))
        boxsz = wx.StaticBoxSizer(sbox, wx.VERTICAL)

        # Launch Config
        cfg = Profile_Get(LAUNCH_PREFS, default=dict())

        # Actions Configuration
        clear_cb = wx.CheckBox(self, ID_AUTOCLEAR,
                               _("Automatically clear buffer between runs"))
        clear_cb.SetValue(cfg.get('autoclear', False))

        # Colors
        colors = dict()
        for btn in COLOR_MAP.iteritems():
            cbtn = eclib.ColorSetter(self, btn[0], color=cfg.get(btn[1]))
            colors[btn[0]] = cbtn

        flexg = wx.FlexGridSizer(5, 5, 5, 5)
        flexg.AddGrowableCol(1, 1)
        flexg.AddGrowableCol(3, 1)
        flexg.AddMany([# First Row
                       ((5, 5), 0), ((5, 5), 1),
                       (wx.StaticText(self, label=_("Foreground")), 0,
                        wx.ALIGN_CENTER),
                       ((5, 5), 1),
                       (wx.StaticText(self, label=_("Background")), 0,
                        wx.ALIGN_CENTER),
                       # Second Row
                       (wx.StaticText(self, label=_("Plain Text") + u":"), 0,
                        wx.ALIGN_CENTER_VERTICAL),
                       ((5, 5), 1),
                       (colors[ID_DEF_FORE], 0, wx.EXPAND),
                       ((5, 5), 1),
                       (colors[ID_DEF_BACK], 0, wx.EXPAND),
                       # Third Row
                       (wx.StaticText(self, label=_("Error Text") + u":"), 0,
                        wx.ALIGN_CENTER_VERTICAL),
                       ((5, 5), 1),
                       (colors[ID_ERR_FORE], 0, wx.EXPAND),
                       ((5, 5), 1),
                       (colors[ID_ERR_BACK], 0, wx.EXPAND),
                       # Fourth Row
                       (wx.StaticText(self, label=_("Info Text") + u":"), 0,
                        wx.ALIGN_CENTER_VERTICAL),
                       ((5, 5), 1),
                       (colors[ID_INFO_FORE], 0, wx.EXPAND),
                       ((5, 5), 1),
                       (colors[ID_INFO_BACK], 0, wx.EXPAND),
                       # Fifth Row
                       (wx.StaticText(self, label=_("Warning Text") + u":"), 0,
                        wx.ALIGN_CENTER_VERTICAL),
                       ((5, 5), 1),
                       (colors[ID_WARN_FORE], 0, wx.EXPAND),
                       ((5, 5), 1),
                       (colors[ID_WARN_BACK], 0, wx.EXPAND)])
        boxsz.Add(flexg, 0, wx.EXPAND)

        # Layout
        msizer.AddMany([((5, 5), 0),
                        (wx.StaticText(self, label=("Actions") + u":"), 0),
                        ((5, 5), 0), (clear_cb, 0),
                        ((10, 10), 0), (wx.StaticLine(self), 0, wx.EXPAND),
                        ((10, 10), 0),
                        (boxsz, 1, wx.EXPAND)])
        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.AddMany([((5, 5), 0), (msizer, 1, wx.EXPAND), ((5, 5), 0)])
        self.SetSizer(hsizer)
Example #17
0
        def __init__( self, title ):
                wx.Frame.__init__ ( self, None, title = title, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 440,600 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

                self.SetIcon(icon.iconset.GetIcon())
                self.SetSizeHintsSz( wx.Size( 430,600 ), wx.Size( 430,600 ) )
                self.SetBackgroundColour( wx.Colour( 240, 240, 240 ) )
                self.Bind(wx.EVT_CLOSE, self.OnClose)

                #Menu and statusbar section
                self.m_statusBar = self.CreateStatusBar( 1, wx.ST_SIZEGRIP, wx.ID_ANY )
                self.m_statusBar.SetFieldsCount(3) 
                self.progress_bar = wx.Gauge(self.m_statusBar, -1, style=wx.GA_HORIZONTAL|wx.GA_SMOOTH) 
                rect = self.m_statusBar.GetFieldRect(2) 
                self.progress_bar.SetPosition((rect.x+2, rect.y+2)) 
                self.progress_bar.SetSize((rect.width-4, rect.height-4)) 

                self.progress_bar.Hide()
                
                self.m_menubar = wx.MenuBar( 0 )
                self.m_menu1 = wx.Menu()
                m_exit = wx.MenuItem( self.m_menu1, wx.ID_EXIT, u"Beenden","\tFenster schließen", wx.ITEM_NORMAL )
                m_gerade = wx.MenuItem( self.m_menu1, wx.ID_ANY, u"Volumen","\tPräparationgerade", wx.ITEM_NORMAL )
                self.Bind(wx.EVT_MENU, self.prep_open, m_gerade)
                self.Bind(wx.EVT_MENU, self.OnClose, m_exit)
                self.m_menu1.AppendItem( m_gerade ) 
                self.m_menu1.AppendItem( m_exit )
                self.m_menubar.Append( self.m_menu1, u"Datei" ) 
                
                self.m_menu2 = wx.Menu()
                m_about = wx.MenuItem( self.m_menu2, wx.ID_ABOUT, u"Über", "\tInfos", wx.ITEM_NORMAL )
                self.Bind(wx.EVT_MENU, self.OnAboutBox, m_about)
                self.m_menu2.AppendItem( m_about )
                
                self.m_menubar.Append( self.m_menu2, u"Hilfe" ) 
                
                self.SetMenuBar( self.m_menubar )
                
                bSizer_main = wx.BoxSizer( wx.VERTICAL )
                
                self.m_bitmap_head = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap( u"Duty.bmp", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.Size( -1,50), 0 )
                bSizer_main.Add( self.m_bitmap_head, 0, wx.ALL|wx.EXPAND, 5 )

                self.m_staticline03 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
                bSizer_main.Add( self.m_staticline03, 0, wx.EXPAND |wx.ALL, 5 )                

                             

                #Parametersection -----------------------------------------------
                sbSizer_param = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Parameter" ), wx.VERTICAL )
                
                bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
                
                self.m_static_on = wx.StaticText( sbSizer_param.GetStaticBox(), wx.ID_ANY, u"T on (ms)     ", wx.DefaultPosition, wx.DefaultSize, 0 )
                self.m_static_on.Wrap( -1 )
                bSizer2.Add( self.m_static_on, 0, wx.ALL, 5 )
                #self.m_static_on.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )

                        #onTime TextCtrl ----------------------------------------
                self.m_text_on = wx.TextCtrl( sbSizer_param.GetStaticBox(),wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
                self.m_text_on.SetMinSize( wx.Size( 100,-1 ) )
                #self.m_text_on.SetFocus()
                
                bSizer2.Add( self.m_text_on, 0, wx.ALL|wx.EXPAND, 5 )
                #self.m_text_on.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )

                self.m_panel11 = wx.Panel( sbSizer_param.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size( 10,-1 ), wx.TAB_TRAVERSAL )
                bSizer2.Add( self.m_panel11, 0, wx.EXPAND |wx.ALL, 5 )
                self.m_panel11.Enable( False )
                
                self.m_static_off = wx.StaticText( sbSizer_param.GetStaticBox(), wx.ID_ANY, u"      T off (ms)", wx.DefaultPosition, wx.DefaultSize, 0 )
                self.m_static_off.Wrap( -1 )
                bSizer2.Add( self.m_static_off, 0, wx.ALL, 5 )
                
                        #offTime TextCtrl ---------------------------------------
                self.m_text_off = wx.TextCtrl( sbSizer_param.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
                self.m_text_off.SetMinSize( wx.Size( 100,-1 ) )
                
                bSizer2.Add( self.m_text_off, 0, wx.ALL|wx.EXPAND, 5 )
                
                sbSizer_param.Add( bSizer2, 1, wx.EXPAND, 5 )
                
                bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
                
                self.m_static_cycle = wx.StaticText( sbSizer_param.GetStaticBox(), wx.ID_ANY, u"Anzahl Pulse", wx.DefaultPosition, wx.DefaultSize, 0 )
                self.m_static_cycle.Wrap( -1 )
                bSizer3.Add( self.m_static_cycle, 0, wx.ALL|wx.EXPAND, 5 )
                #self.m_static_cycle.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )

                        #pulse TextCtrl ------------------------------------------
                self.m_text_pulse = wx.TextCtrl( sbSizer_param.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( -1,-1 ), 0 )
                self.m_text_pulse.SetMinSize( wx.Size( 100,-1 ) )
                #self.m_text_pulse.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )
                
                bSizer3.Add( self.m_text_pulse, 0, wx.ALL|wx.EXPAND, 5 )

                self.m_panel10 = wx.Panel( sbSizer_param.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.Size( 20,-1 ), wx.TAB_TRAVERSAL )
                bSizer3.Add( self.m_panel10, 0, wx.EXPAND |wx.ALL, 5 )
                self.m_panel10.Enable( False )

                        #Speichern Button ----------------------------------------              
                self.m_button_speichern = wx.Button( sbSizer_param.GetStaticBox(), wx.ID_ANY, u"Speichern", wx.DefaultPosition, wx.Size( 170,20 ), 0 )
                self.m_button_speichern.SetToolTipString( u"Speichert die Parameter im EEProm des Interfaces" )
                self.m_button_speichern.Bind(wx.EVT_BUTTON, self.onEnter_ont)
                bSizer3.Add( self.m_button_speichern, 0, wx.ALL|wx.EXPAND, 5 )
                #self.m_button_speichern.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )
                
                
                sbSizer_param.Add( bSizer3, 1, wx.EXPAND, 5 )
                
                bSizer5 = wx.BoxSizer( wx.VERTICAL )
                
                self.m_panel6 = wx.Panel( sbSizer_param.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
                bSizer5.Add( self.m_panel6, 0, wx.EXPAND |wx.ALL, 5 )
                
                
                sbSizer_param.Add( bSizer5, 0, wx.EXPAND, 5 )
                
                bSizer_main.Add( sbSizer_param, 0, wx.ALL|wx.EXPAND, 5 )

                self.m_staticline3 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
                bSizer_main.Add( self.m_staticline3, 0, wx.EXPAND |wx.ALL, 5 )               

                bSizer_mod_vol = wx.BoxSizer( wx.HORIZONTAL )



                #Modussection -------------------------------------------------------
                sbSizer_modus = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Modus" ), wx.VERTICAL )
                
                bSizer6 = wx.BoxSizer( wx.HORIZONTAL )
                
                    #Pulse ----------------------------------------------------------
                self.m_radio_pulse = wx.RadioButton( sbSizer_modus.GetStaticBox(), wx.ID_ANY, u"Pulse", wx.DefaultPosition, wx.DefaultSize, 0 )
                bSizer6.Add( self.m_radio_pulse, 0, wx.ALL|wx.EXPAND, 5 ) 
                #self.m_radio_pulse.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )
                self.m_radio_pulse.Bind(wx.EVT_LEFT_DOWN, self.radio_pulse)
                
                self.m_staticline2 = wx.StaticLine( sbSizer_modus.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL|wx.LI_VERTICAL )
                bSizer6.Add( self.m_staticline2, 0, wx.EXPAND |wx.ALL, 5 )
  

                    #Reinigen -------------------------------------------------------
                self.m_radio_clean = wx.RadioButton( sbSizer_modus.GetStaticBox(), wx.ID_ANY, u"Reinigen", wx.DefaultPosition, wx.DefaultSize, 0 )
                bSizer6.Add( self.m_radio_clean, 0, wx.ALL|wx.EXPAND, 5 )
                #self.m_radio_clean.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )
                self.m_radio_clean.Bind(wx.EVT_LEFT_DOWN, self.radio_clean)
                
                sbSizer_modus.Add( bSizer6, 1, wx.EXPAND, 5 )

                self.m_panel7 = wx.Panel( sbSizer_modus.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
                sbSizer_modus.Add( self.m_panel7, 0, wx.ALL|wx.EXPAND, 2 )



                #Volumensection------------------------------------------------------
                sbSizer_volumen = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Volumen gesamt" ), wx.VERTICAL )
                
                    #Volumen --------------------------------------------------------
                self.m_textCtrl_volume = wx.TextCtrl( sbSizer_volumen.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 180,-1 ), wx.TE_CENTRE|wx.TE_READONLY )
                sbSizer_volumen.Add( self.m_textCtrl_volume, 1, wx.ALL|wx.EXPAND, 5 )
                self.m_textCtrl_volume.SetBackgroundColour( 'green' )
                self.m_panel_vol = wx.Panel(sbSizer_volumen.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
                sbSizer_volumen.Add( self.m_panel_vol, 0, wx.ALL|wx.EXPAND, 3 )
                #self.m_textCtrl_volume.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )

                self.m_panel_mod_vol = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
                
                bSizer_mod_vol.Add( sbSizer_modus, 0, wx.ALL|wx.EXPAND, 5 )
                bSizer_mod_vol.Add( self.m_panel_mod_vol, 1, wx.ALL|wx.EXPAND, 5 )
                bSizer_mod_vol.Add( sbSizer_volumen, 0, wx.ALL|wx.EXPAND, 5 )

                bSizer_main.Add( bSizer_mod_vol, 0, wx.ALL|wx.EXPAND, 5 )
                
                self.m_staticline31 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
                bSizer_main.Add( self.m_staticline31, 0, wx.EXPAND |wx.ALL, 5 )  



                #Start/Stopp section ------------------------------------------------
                sbSizer_start = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Start / Stopp" ), wx.VERTICAL )
                
                bSizer7 = wx.BoxSizer( wx.HORIZONTAL )
                
                self.m_button_start = wx.Button( sbSizer_start.GetStaticBox(), wx.ID_ANY, u"Start", wx.DefaultPosition, wx.DefaultSize, 0 )
                #self.m_button_start.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )
                self.m_button_start.SetToolTipString( u"Start des Modus mit voreingestellten Parametern" )
                #self.m_button_start.SetFont( wx.Font( wx.NORMAL_FONT.GetPointSize(), 70, 90, 90, False, wx.EmptyString ) )
                self.m_button_start.SetForegroundColour( wx.Colour( 9, 125, 2 ) )
                self.m_button_start.SetMinSize( wx.Size( -1,40 ) )
                self.m_button_start.SetMaxSize( wx.Size( -1,40 ) )
                self.m_button_start.Bind(wx.EVT_BUTTON, self.on_start)
                
                bSizer7.Add( self.m_button_start, 1, wx.ALL, 5 )
                
                self.m_button_stopp = wx.Button( sbSizer_start.GetStaticBox(), wx.ID_ANY, u"Stopp", wx.DefaultPosition, wx.DefaultSize, 0 )
                #self.m_button_stopp.SetFont( wx.Font( 9, 74, 90, 90, False, "Segoe UI" ) )
                self.m_button_stopp.SetToolTipString( u"Unterbricht den Modus" )
                self.m_button_stopp.SetForegroundColour( wx.Colour( 225, 0, 0 ) )
                self.m_button_stopp.SetMinSize( wx.Size( -1,40 ) )
                self.m_button_stopp.SetMaxSize( wx.Size( -1,40 ) )
                self.m_button_stopp.Enable( False )
                self.m_button_stopp.Bind(wx.EVT_BUTTON, self.on_stop)
                
                bSizer7.Add( self.m_button_stopp, 1, wx.ALL, 5 )
                
                
                sbSizer_start.Add( bSizer7, 1, wx.EXPAND, 5 )
                
                self.m_panel8 = wx.Panel( sbSizer_start.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
                sbSizer_start.Add( self.m_panel8, 0, wx.EXPAND |wx.ALL, 5 )
                
                
                bSizer_main.Add( sbSizer_start, 0, wx.ALL|wx.EXPAND, 5 )
                
                self.m_staticline32 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
                bSizer_main.Add( self.m_staticline32, 0, wx.EXPAND |wx.ALL, 5 )  


                

                #Serialcontroll section ---------------------------------------------
                sbSizer_serial = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Serial Control" ), wx.VERTICAL )
                
                sbSizer_serial.SetMinSize( wx.Size( -1,60 ) ) 
                bSizer8 = wx.BoxSizer( wx.HORIZONTAL )
                
                m_comboBox_comChoices = [ "" ]
                self.m_comboBox_com = wx.ComboBox( sbSizer_serial.GetStaticBox(), wx.ID_ANY, u"COM", wx.DefaultPosition, wx.DefaultSize, m_comboBox_comChoices, 0 )
                bSizer8.Add( self.m_comboBox_com, 0, wx.ALL, 5 )
                self.m_comboBox_com.SetItems(portlist)
                self.m_comboBox_com.SetSelection( 0 )
                self.m_comboBox_com.Bind(wx.EVT_COMBOBOX, self.choice_focus)
                
                m_comboBox_baudChoices = [ u"9600", u"19200", u"38400", u"57600", u"115200" ]
                self.m_comboBox_baud = wx.ComboBox( sbSizer_serial.GetStaticBox(), wx.ID_ANY, u"baud", wx.DefaultPosition, wx.DefaultSize, m_comboBox_baudChoices, 0 )
                self.m_comboBox_baud.SetSelection( 3 )
                self.m_comboBox_baud.Bind(wx.EVT_COMBOBOX, self.choice_focus)
                bSizer8.Add( self.m_comboBox_baud, 0, wx.ALL, 5 )        
                

                    #Serial TextCtrl -------------------------------------------
                self.m_textCtrl_serial = wx.TextCtrl( sbSizer_serial.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
                bSizer8.Add( self.m_textCtrl_serial, 1, wx.ALL, 5 )
                
                sbSizer_serial.Add( bSizer8, 1, wx.EXPAND, 5 )    

                        #Aktualiseren Button -----------------------------------
                self.aktualisieren = wx.Button( sbSizer_serial.GetStaticBox(), wx.ID_ANY, u"aktualisieren", wx.DefaultPosition, wx.DefaultSize, 0 )
                sbSizer_serial.Add( self.aktualisieren, 1, wx.ALL|wx.EXPAND, 5 )
                self.aktualisieren.Bind(wx.EVT_BUTTON, self.akt_action)

                self.m_panel9 = wx.Panel( sbSizer_serial.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
                sbSizer_serial.Add( self.m_panel9, 0, wx.EXPAND |wx.ALL, 2 )
                
                bSizer_main.Add( sbSizer_serial, 0, wx.ALL|wx.EXPAND, 5 )
                
                self.SetSizer( bSizer_main )
                self.Layout()
                
                self.Centre( wx.BOTH )

                #Startup section
                self.m_radio_pulse.SetValue( True )
                self.m_textCtrl_volume.Enable( False )
                self.timer = wx.Timer(self)
                self.Bind(wx.EVT_TIMER, self.show_puls, self.timer)

                if portlist != []:
                        ser.port = self.m_comboBox_com.GetString(self.m_comboBox_com.GetSelection())
                        ser.baudrate = int(self.m_comboBox_baud.GetString(self.m_comboBox_baud.GetSelection()))
                        ser.open()
                        if ser.is_open:
                                serstring = ser.readline()
                                #print(serstring)
                                ser.write('con')
                                time.sleep(0.05)
                                ser.write('pul')
                                self.m_statusBar.PushStatusText("\tVerbunden", 0)
                                serplit = serstring.split(",")
                                self.m_text_on.SetValue((serplit[0]))
                                self.m_text_off.SetValue((serplit[1]))
                                self.m_text_pulse.SetValue((serplit[2]))
                                self.m_textCtrl_volume.SetValue(str(round((4.2667+0.89261*int(serplit[0]))*int(serplit[2]),1))+u" µl"+" "+ unichr(177)+ " "+ str(2*int(serplit[2]))+u" µl")
                        self.aktualisieren.Enable( False )
                        self.m_textCtrl_volume.Enable( True )
                elif portlist == []:
                        self.m_comboBox_com.Enable( False )
                        self.m_comboBox_baud.Enable( False )
                        self.m_textCtrl_serial.WriteText(" System nicht verbunden\n")
                        self.m_textCtrl_serial.Enable( False )
                        self.m_button_start.Enable( False )
                        self.m_button_stopp.Enable( False )
                        self.m_radio_pulse.Enable( False )
                        #self.m_radio_menge.Enable( False )
                        self.m_radio_clean.Enable( False )
                        self.m_text_pulse.Enable( False )
                        self.m_text_on.Enable( False )
                        self.m_text_off.Enable( False )
                        self.m_button_speichern.Enable( False )
                        self.m_statusBar.PushStatusText("\tNicht verbunden", 0)
Example #18
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           id=wx.ID_ANY,
                           title=u"PlugSy - SDK",
                           pos=wx.DefaultPosition,
                           size=wx.DefaultSize,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP)

        self.SetSizeHints(wx.Size(400, 100), wx.DefaultSize)

        sbSizer1 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Plugins Home"), wx.VERTICAL)

        sbSizer1.SetMinSize(wx.Size(400, 100))
        self.m_panel10 = wx.Panel(sbSizer1.GetStaticBox(), wx.ID_ANY,
                                  wx.DefaultPosition, wx.DefaultSize,
                                  wx.TAB_TRAVERSAL)
        bSizer12 = wx.BoxSizer(wx.VERTICAL)

        bSizer15 = wx.BoxSizer(wx.HORIZONTAL)

        self.PluginsHomeDirPicker = wx.DirPickerCtrl(self.m_panel10, wx.ID_ANY,
                                                     wx.EmptyString, u"test",
                                                     wx.DefaultPosition,
                                                     wx.DefaultSize,
                                                     wx.DIRP_USE_TEXTCTRL)
        self.PluginsHomeDirPicker.SetToolTip(
            u"Select the plugins' home directory. This is the location in which plugins are created, loaded and stored"
        )

        bSizer15.Add(self.PluginsHomeDirPicker, 1,
                     wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5)

        bSizer12.Add(bSizer15, 1, wx.EXPAND, 5)

        bSizer18 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer18.Add((0, 0), 1, wx.EXPAND, 5)

        self.LogLevelLabel = wx.StaticText(self.m_panel10, wx.ID_ANY,
                                           u"Log Level", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.LogLevelLabel.Wrap(-1)
        bSizer18.Add(self.LogLevelLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                     5)

        LogLevelChoiceChoices = [
            wx.EmptyString, u"Debug", u"Info", u"Warning", u"Error",
            u"Critical"
        ]
        self.LogLevelChoice = wx.Choice(self.m_panel10, wx.ID_ANY,
                                        wx.DefaultPosition, wx.DefaultSize,
                                        LogLevelChoiceChoices, 0)
        self.LogLevelChoice.SetSelection(0)
        bSizer18.Add(self.LogLevelChoice, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL,
                     5)

        self.LogFilePathLabel = wx.StaticText(self.m_panel10, wx.ID_ANY,
                                              u"Log File Path",
                                              wx.DefaultPosition,
                                              wx.DefaultSize, 0)
        self.LogFilePathLabel.Wrap(-1)
        bSizer18.Add(self.LogFilePathLabel, 0,
                     wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.LogFilePathTextCtrl = wx.TextCtrl(self.m_panel10, wx.ID_ANY,
                                               wx.EmptyString,
                                               wx.DefaultPosition,
                                               wx.DefaultSize, 0)
        bSizer18.Add(self.LogFilePathTextCtrl, 0,
                     wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        bSizer18.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer12.Add(bSizer18, 1, wx.EXPAND, 5)

        self.m_panel10.SetSizer(bSizer12)
        self.m_panel10.Layout()
        bSizer12.Fit(self.m_panel10)
        sbSizer1.Add(self.m_panel10, 3, wx.EXPAND | wx.ALL, 10)

        bSizer11 = wx.BoxSizer(wx.VERTICAL)

        self.StatusLabel = wx.StaticText(sbSizer1.GetStaticBox(), wx.ID_ANY,
                                         wx.EmptyString, wx.DefaultPosition,
                                         wx.DefaultSize, 0)
        self.StatusLabel.Wrap(-1)
        self.StatusLabel.SetForegroundColour(wx.Colour(255, 0, 0))

        bSizer11.Add(self.StatusLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        OkCancelSizer = wx.StdDialogButtonSizer()
        self.OkCancelSizerOK = wx.Button(sbSizer1.GetStaticBox(), wx.ID_OK)
        OkCancelSizer.AddButton(self.OkCancelSizerOK)
        self.OkCancelSizerCancel = wx.Button(sbSizer1.GetStaticBox(),
                                             wx.ID_CANCEL)
        OkCancelSizer.AddButton(self.OkCancelSizerCancel)
        OkCancelSizer.Realize()

        bSizer11.Add(OkCancelSizer, 1, wx.EXPAND, 5)

        sbSizer1.Add(bSizer11, 2, wx.EXPAND, 5)

        self.SetSizer(sbSizer1)
        self.Layout()
        sbSizer1.Fit(self)

        self.Centre(wx.BOTH)
    def __do_layout(self):
        grid_sizer_base0 = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)
        grid_sizer_base = wx.FlexGridSizer(rows=1, cols=2, vgap=10, hgap=10)
        grid_sizer_droit = wx.FlexGridSizer(rows=2, cols=1, vgap=5, hgap=5)
        staticbox_listesdiff = wx.StaticBoxSizer(self.staticbox_listesdiff,
                                                 wx.VERTICAL)
        grid_sizer_listesdiff = wx.FlexGridSizer(rows=2,
                                                 cols=1,
                                                 vgap=5,
                                                 hgap=5)
        staticbox_coords = wx.StaticBoxSizer(self.staticbox_coords,
                                             wx.VERTICAL)
        grid_sizer_coords = wx.FlexGridSizer(rows=4, cols=2, vgap=5, hgap=5)
        grid_sizer_gauche = wx.FlexGridSizer(rows=2, cols=1, vgap=5, hgap=5)
        staticbox_travail = wx.StaticBoxSizer(self.staticbox_travail,
                                              wx.VERTICAL)
        grid_sizer_travail = wx.FlexGridSizer(rows=3, cols=4, vgap=5, hgap=5)
        staticbox_adresse = wx.StaticBoxSizer(self.staticbox_adresse,
                                              wx.VERTICAL)
        grid_sizer_adresse = wx.FlexGridSizer(rows=2, cols=2, vgap=5, hgap=5)
        grid_sizer_adresse_manuelle = wx.FlexGridSizer(rows=2,
                                                       cols=1,
                                                       vgap=5,
                                                       hgap=5)
        grid_sizer_adresse_manuelle_2 = wx.FlexGridSizer(rows=4,
                                                         cols=2,
                                                         vgap=5,
                                                         hgap=5)
        grid_sizer_adresse_auto = wx.FlexGridSizer(rows=1,
                                                   cols=2,
                                                   vgap=5,
                                                   hgap=5)
        grid_sizer_adresse.Add(self.radio_adresse_auto, 0,
                               wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_adresse_auto.Add(self.label_adresse_auto, 0,
                                    wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_adresse_auto.Add(self.ctrl_adresse_auto, 0, wx.EXPAND, 0)
        grid_sizer_adresse_auto.AddGrowableCol(1)
        grid_sizer_adresse.Add(grid_sizer_adresse_auto, 1, wx.EXPAND, 0)
        grid_sizer_adresse.Add(self.radio_adresse_manuelle, 0, 0, 0)
        grid_sizer_adresse_manuelle.Add(self.label_adresse_manuelle, 0, 0, 0)
        grid_sizer_adresse_manuelle_2.Add(
            self.label_rue, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_adresse_manuelle_2.Add(self.ctrl_rue, 0, wx.EXPAND, 0)
        grid_sizer_adresse_manuelle_2.Add(
            self.label_cp, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_adresse_manuelle_2.Add(self.ctrl_ville, 0, wx.EXPAND, 0)
        grid_sizer_adresse_manuelle_2.Add(
            self.label_secteur, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
            0)

        grid_sizer_secteur = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)
        grid_sizer_secteur.Add(self.ctrl_secteur, 0, wx.EXPAND, 0)
        grid_sizer_secteur.Add(self.bouton_secteurs, 0, wx.EXPAND, 0)
        grid_sizer_secteur.AddGrowableCol(0)
        grid_sizer_adresse_manuelle_2.Add(grid_sizer_secteur, 0, wx.EXPAND, 0)

        grid_sizer_adresse_manuelle_2.AddGrowableCol(1)
        grid_sizer_adresse_manuelle.Add(grid_sizer_adresse_manuelle_2, 1,
                                        wx.EXPAND, 0)
        grid_sizer_adresse_manuelle.AddGrowableCol(0)
        grid_sizer_adresse.Add(grid_sizer_adresse_manuelle, 1, wx.EXPAND, 0)
        grid_sizer_adresse.AddGrowableCol(1)
        staticbox_adresse.Add(grid_sizer_adresse, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_gauche.Add(staticbox_adresse, 1, wx.EXPAND, 0)
        grid_sizer_travail.Add(self.label_categorie, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_travail.Add(self.ctrl_categorie, 0, wx.EXPAND, 0)
        grid_sizer_travail.Add(self.label_travail_tel, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_travail.Add(self.ctrl_travail_tel, 0, 0, 0)
        grid_sizer_travail.Add(self.label_profession, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_travail.Add(self.ctrl_profession, 0, wx.EXPAND, 0)
        grid_sizer_travail.Add(self.label_travail_fax, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_travail.Add(self.ctrl_travail_fax, 0, 0, 0)
        grid_sizer_travail.Add(self.label_employeur, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_travail.Add(self.ctrl_employeur, 0, wx.EXPAND, 0)
        grid_sizer_travail.Add(self.label_travail_mail, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)

        # GridSizer Email Travail
        grid_sizer_mail_travail = wx.FlexGridSizer(rows=1,
                                                   cols=2,
                                                   vgap=2,
                                                   hgap=2)
        grid_sizer_mail_travail.Add(self.ctrl_travail_mail, 0, wx.EXPAND, 0)
        grid_sizer_mail_travail.Add(self.bouton_mail_travail, 0, wx.EXPAND, 0)
        grid_sizer_travail.Add(grid_sizer_mail_travail, 0, wx.EXPAND, 0)

        grid_sizer_travail.AddGrowableCol(1)
        staticbox_travail.Add(grid_sizer_travail, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_gauche.Add(staticbox_travail, 1, wx.EXPAND, 0)
        grid_sizer_base.Add(grid_sizer_gauche, 1, wx.EXPAND, 0)
        grid_sizer_coords.Add(self.label_tel_domicile, 0,
                              wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_coords.Add(self.ctrl_tel_domicile, 0, 0, 0)
        grid_sizer_coords.Add(self.label_tel_mobile, 0,
                              wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_coords.Add(self.ctrl_tel_mobile, 0, 0, 0)
        grid_sizer_coords.Add(self.label_tel_fax, 0,
                              wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_coords.Add(self.ctrl_tel_fax, 0, 0, 0)
        grid_sizer_coords.Add(self.label_mail, 0,
                              wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)

        # GridSizer Email perso
        grid_sizer_mail_perso = wx.FlexGridSizer(rows=1,
                                                 cols=2,
                                                 vgap=2,
                                                 hgap=2)
        grid_sizer_mail_perso.Add(self.ctrl_mail, 0, wx.EXPAND, 0)
        grid_sizer_mail_perso.Add(self.bouton_mail_perso, 0, wx.EXPAND, 0)
        grid_sizer_coords.Add(grid_sizer_mail_perso, 0, wx.EXPAND, 0)

        staticbox_coords.Add(grid_sizer_coords, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_droit.Add(staticbox_coords, 1, wx.EXPAND, 0)
        grid_sizer_listesdiff.Add(self.label_listesdiff, 0, 0, 0)
        grid_sizer_listesdiff.Add(self.ctrl_listesdiff, 0, wx.EXPAND, 0)
        grid_sizer_listesdiff.AddGrowableRow(1)
        grid_sizer_listesdiff.AddGrowableCol(0)
        staticbox_listesdiff.Add(grid_sizer_listesdiff, 1, wx.ALL | wx.EXPAND,
                                 5)
        grid_sizer_droit.Add(staticbox_listesdiff, 1, wx.EXPAND, 0)
        grid_sizer_droit.AddGrowableRow(1)
        grid_sizer_droit.AddGrowableCol(0)
        grid_sizer_base.Add(grid_sizer_droit, 1, wx.EXPAND, 0)

        grid_sizer_gauche.AddGrowableCol(0)
        grid_sizer_base.AddGrowableCol(0)

        grid_sizer_base0.Add(grid_sizer_base, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(grid_sizer_base0)
        grid_sizer_base0.Fit(self)
        grid_sizer_base0.AddGrowableCol(0)
Example #20
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"PlugSy - v0.1.0",
                          pos=wx.DefaultPosition,
                          size=wx.Size(650, 450),
                          style=wx.DEFAULT_FRAME_STYLE | wx.SYSTEM_MENU
                          | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        bSizer8 = wx.BoxSizer(wx.VERTICAL)

        self.Notebook = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition,
                                    wx.DefaultSize, 0)
        self.SdkPanel = wx.Panel(self.Notebook, wx.ID_ANY, wx.DefaultPosition,
                                 wx.DefaultSize, wx.TAB_TRAVERSAL)
        bSizer12 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer25 = wx.BoxSizer(wx.VERTICAL)

        self.PluginsTreeCtrl = wx.TreeCtrl(
            self.SdkPanel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
            wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)
        bSizer25.Add(self.PluginsTreeCtrl, 88, wx.ALL | wx.EXPAND, 5)

        bSizer12.Add(bSizer25, 1, wx.EXPAND, 5)

        bSizer6 = wx.BoxSizer(wx.VERTICAL)

        sbSizer2 = wx.StaticBoxSizer(
            wx.StaticBox(self.SdkPanel, wx.ID_ANY, u"Plugin Settings"),
            wx.VERTICAL)

        self.m_panel22 = wx.Panel(sbSizer2.GetStaticBox(), wx.ID_ANY,
                                  wx.DefaultPosition, wx.DefaultSize,
                                  wx.TAB_TRAVERSAL)
        bSizer56 = wx.BoxSizer(wx.VERTICAL)

        bSizer7 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer81 = wx.BoxSizer(wx.HORIZONTAL)

        self.PluginNameLabel = wx.StaticText(self.m_panel22, wx.ID_ANY,
                                             u"Name", wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.PluginNameLabel.Wrap(-1)
        bSizer81.Add(self.PluginNameLabel, 0, wx.ALL, 8)

        bSizer81.Add((0, 0), 1, wx.EXPAND, 5)

        self.PluginNameTextCtrl = wx.TextCtrl(self.m_panel22, wx.ID_ANY,
                                              wx.EmptyString,
                                              wx.DefaultPosition,
                                              wx.DefaultSize, wx.TE_READONLY)
        bSizer81.Add(self.PluginNameTextCtrl, 0, wx.ALL, 5)

        bSizer7.Add(bSizer81, 1, wx.EXPAND, 5)

        bSizer811 = wx.BoxSizer(wx.HORIZONTAL)

        self.PluginTypeLabel = wx.StaticText(self.m_panel22, wx.ID_ANY,
                                             u"Type", wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.PluginTypeLabel.Wrap(-1)
        bSizer811.Add(self.PluginTypeLabel, 0, wx.ALL, 8)

        bSizer811.Add((0, 0), 1, wx.EXPAND, 5)

        PluginTypeComboBoxChoices = [u"Core", u"Addon"]
        self.PluginTypeComboBox = wx.ComboBox(self.m_panel22, wx.ID_ANY,
                                              u"Core", wx.DefaultPosition,
                                              wx.DefaultSize,
                                              PluginTypeComboBoxChoices,
                                              wx.CB_READONLY)
        self.PluginTypeComboBox.Enable(False)

        bSizer811.Add(self.PluginTypeComboBox, 0, wx.ALL, 5)

        bSizer7.Add(bSizer811, 1, wx.EXPAND, 5)

        bSizer56.Add(bSizer7, 1, wx.EXPAND, 5)

        self.m_panel22.SetSizer(bSizer56)
        self.m_panel22.Layout()
        bSizer56.Fit(self.m_panel22)
        sbSizer2.Add(self.m_panel22, 1, wx.EXPAND | wx.ALL, 10)

        bSizer6.Add(sbSizer2, 3, wx.EXPAND, 5)

        sbSizer3 = wx.StaticBoxSizer(
            wx.StaticBox(self.SdkPanel, wx.ID_ANY, wx.EmptyString),
            wx.HORIZONTAL)

        sbSizer3.Add((0, 0), 1, wx.EXPAND, 5)

        self.DeletePluginButton = wx.Button(sbSizer3.GetStaticBox(), wx.ID_ANY,
                                            u"Delete Plugin",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.DeletePluginButton.SetFont(
            wx.Font(9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_BOLD, False, "Arial"))
        self.DeletePluginButton.Enable(False)

        sbSizer3.Add(self.DeletePluginButton, 0, wx.ALL, 5)

        sbSizer3.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer6.Add(sbSizer3, 0, wx.EXPAND, 5)

        bSizer12.Add(bSizer6, 2, wx.EXPAND, 5)

        self.SdkPanel.SetSizer(bSizer12)
        self.SdkPanel.Layout()
        bSizer12.Fit(self.SdkPanel)
        self.Notebook.AddPage(self.SdkPanel, u"SDK", True)

        bSizer8.Add(self.Notebook, 1, wx.EXPAND | wx.ALL, 2)

        self.SetSizer(bSizer8)
        self.Layout()
        self.MenuBar = wx.MenuBar(0)
        self.MenuBar.SetFont(
            wx.Font(9, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                    wx.FONTWEIGHT_NORMAL, True, "Arial"))

        self.FileMenu = wx.Menu()
        self.FileMenu.AppendSeparator()

        self.ExitMenuItem = wx.MenuItem(self.FileMenu, wx.ID_ANY, u"Exit",
                                        wx.EmptyString, wx.ITEM_NORMAL)
        self.FileMenu.Append(self.ExitMenuItem)

        self.MenuBar.Append(self.FileMenu, u"File")

        self.PluginMenu = wx.Menu()
        self.NewPluginMenuItem = wx.MenuItem(
            self.PluginMenu, wx.ID_ANY, u"New Plugin" + u"\t" + u"Ctrl + n",
            wx.EmptyString, wx.ITEM_NORMAL)
        self.PluginMenu.Append(self.NewPluginMenuItem)

        self.MenuBar.Append(self.PluginMenu, u"Plugin")

        self.SetMenuBar(self.MenuBar)

        self.StatusBar = self.CreateStatusBar(1, wx.STB_SIZEGRIP, wx.ID_ANY)

        self.Centre(wx.BOTH)
Example #21
0
    def InitControls(self):
        """Create labels and controls based on the figure's attributes"""

        # Get current axes labels
        plottitle = xaxislbl = y1axislbl = y2axislbl = "N/A"

        if len(self.figure.axes) > 0:
            plottitle = self.figure.axes[0].title.get_text()
            xaxislbl = self.figure.axes[0].get_xlabel()
            y1axislbl = self.figure.axes[0].get_ylabel()
        if len(self.figure.axes) == 2:
            y2axislbl = self.figure.axes[1].get_ylabel()

        tLbl = wx.StaticText(self, -1, "Title:")
        tTxt = wx.TextCtrl(self, -1, plottitle, size=(175, -1))
        xLbl = wx.StaticText(self, -1, "X-axis:")
        xTxt = wx.TextCtrl(self, -1, xaxislbl, size=(175, -1))
        y1Lbl = wx.StaticText(self, -1, "Y1-axis:")
        y1Txt = wx.TextCtrl(self, -1, y1axislbl, size=(175, -1))
        y2Lbl = wx.StaticText(self, -1, "Y2-axis:")
        y2Txt = wx.TextCtrl(self, -1, y2axislbl, size=(175, -1))

        if len(self.figure.axes) < 2:
            y2Txt.SetEditable(False)
            if len(self.figure.axes) == 0:
                tTxt.SetEditable(False)
                xTxt.SetEditable(False)
                y1Txt.SetEditable(False)

        self.axesCtrls = [(tLbl, tTxt), (xLbl, xTxt), (y1Lbl, y1Txt),
                          (y2Lbl, y2Txt)]

        self.lineCtrls = [(wx.StaticText(self.scroll, -1, "Column:"),
                           wx.StaticText(self.scroll, -1, "Color:"),
                           wx.StaticText(self.scroll, -1, ""))]

        for axis in self.figure.axes:
            for line in axis.lines:
                color = self.MplToWxColour(line.get_color())
                lineTxt = wx.TextCtrl(self.scroll,
                                      -1,
                                      line.get_label().lstrip("_"),
                                      size=(175, -1))
                lineColor = wx.TextCtrl(self.scroll, -1,
                                        "#%02x%02x%02x" % color.Get())
                lineBtn = wx.Button(self.scroll, -1, size=(25, 25))
                lineBtn.SetBackgroundColour(color)
                self.Bind(wx.EVT_BUTTON, self.OnColor, lineBtn)
                self.Bind(wx.EVT_TEXT, self.OnColorChange, lineColor)
                self.lineCtrls.append((lineTxt, lineColor, lineBtn))

        self.advancedBtn = wx.Button(self, -1, "Advanced Options...")
        self.updateBtn = wx.Button(self, wx.ID_OK, "Update Plot")
        self.cancelBtn = wx.Button(self, wx.ID_CANCEL, "Cancel")

        self.Bind(wx.EVT_BUTTON, self.OnAdvanced, self.advancedBtn)
        self.Bind(wx.EVT_BUTTON, self.OnUpdate, self.updateBtn)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, self.cancelBtn)

        # Place controls
        boxSizer = wx.BoxSizer(wx.VERTICAL)
        axesBox = wx.StaticBox(self, -1, "Axes")
        axesBoxSizer = wx.StaticBoxSizer(axesBox, wx.VERTICAL)
        axesSizer = wx.FlexGridSizer(rows=4, cols=2, vgap=3, hgap=3)
        for ctrl in self.axesCtrls:
            axesSizer.AddMany([(ctrl[0], 0, wx.ALIGN_RIGHT | wx.EXPAND),
                               (ctrl[1], 0, wx.ALIGN_LEFT | wx.EXPAND)])
        axesSizer.AddGrowableCol(1)
        axesBoxSizer.Add(axesSizer, 0, wx.EXPAND)

        lineBox = wx.StaticBox(self, -1, "Lines")
        lineBoxSizer = wx.StaticBoxSizer(lineBox, wx.VERTICAL)
        lineSizer = wx.FlexGridSizer(rows=len(self.lineCtrls) + 1,
                                     cols=4,
                                     vgap=3,
                                     hgap=3)
        for ctrls in self.lineCtrls:
            lineSizer.AddMany([(ctrls[0], 0, wx.ALIGN_LEFT | wx.EXPAND),
                               (ctrls[1], 0, wx.ALIGN_LEFT),
                               (ctrls[2], 0,
                                wx.ALIGN_CENTER | wx.FIXED_MINSIZE),
                               ((3, 3), 0, wx.ALIGN_CENTER)])
        lineSizer.AddGrowableCol(0)
        self.scroll.SetSizer(lineSizer)

        width = self.scroll.GetBestSize().width + 25  # for scrollbar
        height = self.scroll.GetBestSize().height
        if height > 400:
            height = 400
            width = width + 25  # button size
        self.scroll.SetScrollbars(0, 10, 1, 1)

        lineBoxSizer.Add(self.scroll, 1, wx.EXPAND)

        controlSizer = wx.BoxSizer(wx.HORIZONTAL)
        controlSizer.AddMany([(self.updateBtn, 1, wx.ALIGN_CENTER | wx.EXPAND),
                              (self.cancelBtn, 1, wx.ALIGN_CENTER | wx.EXPAND)
                              ])

        boxSizer.AddMany([(axesBoxSizer, 0, wx.EXPAND),
                          (lineBoxSizer, 1, wx.EXPAND),
                          (self.advancedBtn, 0, wx.EXPAND),
                          (controlSizer, 0, wx.EXPAND)])

        totalHeight = height + axesBoxSizer.GetMinSize().GetHeight() + \
                self.advancedBtn.GetSize().GetHeight() + \
                controlSizer.GetMinSize().GetHeight()
        boxSizer.SetMinSize((width, totalHeight))
        self.SetSizer(boxSizer)
        self.SetAutoLayout(1)
        self.Fit()

        height = self.GetSize().GetHeight()
        self.SetSizeHints(minH=height + 25,
                          maxH=height * 2,
                          minW=width,
                          maxW=width * 5)
Example #22
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           id=wx.ID_ANY,
                           title=u"PlugSy - New Plugin",
                           pos=wx.DefaultPosition,
                           size=wx.Size(446, 160),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        sbSizer4 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"New Plugin"), wx.VERTICAL)

        self.m_panel4 = wx.Panel(sbSizer4.GetStaticBox(), wx.ID_ANY,
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.TAB_TRAVERSAL)
        bSizer20 = wx.BoxSizer(wx.VERTICAL)

        bSizer22 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer21 = wx.BoxSizer(wx.HORIZONTAL)

        self.PluginNameLabel = wx.StaticText(self.m_panel4, wx.ID_ANY,
                                             u"Plugin Name",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.PluginNameLabel.Wrap(-1)
        bSizer21.Add(self.PluginNameLabel, 0, wx.ALL, 8)

        bSizer21.Add((0, 0), 1, wx.EXPAND, 5)

        self.PluginNameTextCtrl = wx.TextCtrl(self.m_panel4, wx.ID_ANY,
                                              wx.EmptyString,
                                              wx.DefaultPosition,
                                              wx.DefaultSize, 0)
        bSizer21.Add(self.PluginNameTextCtrl, 0, wx.ALL, 5)

        bSizer22.Add(bSizer21, 1, wx.EXPAND, 5)

        wSizer4 = wx.WrapSizer(wx.HORIZONTAL)

        self.PluginTypeLabel = wx.StaticText(self.m_panel4, wx.ID_ANY,
                                             u"Plugin Type",
                                             wx.DefaultPosition,
                                             wx.DefaultSize, 0)
        self.PluginTypeLabel.Wrap(-1)
        wSizer4.Add(self.PluginTypeLabel, 0, wx.ALL, 8)

        wSizer4.Add((0, 0), 1, wx.EXPAND, 5)

        PluginTypeChoiceChoices = [u"core", u"addon"]
        self.PluginTypeChoice = wx.Choice(self.m_panel4, wx.ID_ANY,
                                          wx.DefaultPosition, wx.DefaultSize,
                                          PluginTypeChoiceChoices, 0)
        self.PluginTypeChoice.SetSelection(0)
        wSizer4.Add(self.PluginTypeChoice, 0, wx.ALL, 5)

        bSizer22.Add(wSizer4, 1, wx.EXPAND, 5)

        bSizer20.Add(bSizer22, 1, wx.EXPAND, 5)

        self.m_panel4.SetSizer(bSizer20)
        self.m_panel4.Layout()
        bSizer20.Fit(self.m_panel4)
        sbSizer4.Add(self.m_panel4, 1, wx.ALL | wx.EXPAND, 5)

        bSizer23 = wx.BoxSizer(wx.VERTICAL)

        self.StatusLabel = wx.StaticText(sbSizer4.GetStaticBox(), wx.ID_ANY,
                                         wx.EmptyString, wx.DefaultPosition,
                                         wx.DefaultSize, 0)
        self.StatusLabel.Wrap(-1)
        self.StatusLabel.SetForegroundColour(wx.Colour(255, 0, 0))

        bSizer23.Add(self.StatusLabel, 0, wx.ALL, 5)

        OkCanelSizer = wx.StdDialogButtonSizer()
        self.OkCanelSizerOK = wx.Button(sbSizer4.GetStaticBox(), wx.ID_OK)
        OkCanelSizer.AddButton(self.OkCanelSizerOK)
        self.OkCanelSizerCancel = wx.Button(sbSizer4.GetStaticBox(),
                                            wx.ID_CANCEL)
        OkCanelSizer.AddButton(self.OkCanelSizerCancel)
        OkCanelSizer.Realize()

        bSizer23.Add(OkCanelSizer, 1, wx.EXPAND, 5)

        sbSizer4.Add(bSizer23, 1, wx.EXPAND, 5)

        self.SetSizer(sbSizer4)
        self.Layout()

        self.Centre(wx.BOTH)
Example #23
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        #wx.Panel.__init__(self, id=-1, parent=prnt)#, size=wx.Size(442, 637))
        self._init_utils()
        #self.SetClientSize(wx.Size(434, 610))
        #vsizer= wx.BoxSizer(wx.VERTICAL)

        ################ Splitter ######################

        item = afp.foldingPane(self,
                               -1,
                               caption="Virtual Hardware",
                               pinned=True)

        #sbsizer = wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Image splitting & PSF'),
        #                            wx.VERTICAL)

        pane = wx.Panel(item, -1)

        sbsizer = wx.BoxSizer(wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        hsizer.Add(wx.StaticText(pane, -1, 'Number of detection channels: '),
                   0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)
        self.cNumSplitterChans = wx.Choice(pane,
                                           -1,
                                           choices=[
                                               '1 - Standard',
                                               '2 - Ratiometric/Biplane',
                                               '4 - HT / 4Pi-SMS'
                                           ])
        self.cNumSplitterChans.SetSelection(0)
        self.cNumSplitterChans.Bind(wx.EVT_CHOICE, self.OnNumChannelsChanged)
        hsizer.Add(self.cNumSplitterChans, 0,
                   wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 10)
        sbsizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 2)

        self.gSplitter = wx.grid.Grid(pane, -1)
        self.setupSplitterGrid()
        self.OnNumChannelsChanged()
        sbsizer.Add(self.gSplitter, 0, wx.RIGHT | wx.EXPAND, 2)

        sbsizer.AddSpacer(8)

        ############## PSF Settings ################
        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.st_psf = wx.StaticText(pane, -1, 'PSF: Default widefield')
        hsizer.Add(self.st_psf, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 4)

        hsizer.AddStretchSpacer()

        self.bSetTPSF = wx.Button(pane, -1, 'Set Theoretical')
        self.bSetTPSF.Bind(wx.EVT_BUTTON, self.OnBSetPSFModel)
        hsizer.Add(self.bSetTPSF, 1, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)

        self.bSetPSF = wx.Button(pane, -1, 'Set Experimental')
        self.bSetPSF.Bind(wx.EVT_BUTTON, self.OnBSetPSF)
        hsizer.Add(self.bSetPSF, 1, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)

        self.bSavePSF = wx.Button(pane, -1, 'Save')
        self.bSavePSF.Bind(wx.EVT_BUTTON, self.OnBSavePSF)
        hsizer.Add(self.bSavePSF, 1, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)

        sbsizer.Add(hsizer, 0, wx.ALL, 2)

        sbsizer.AddSpacer(8)

        pane.SetSizerAndFit(sbsizer)

        item.AddNewElement(pane)
        self.AddPane(item)

        #vsizer.Add(sbsizer, 0, wx.ALL | wx.EXPAND, 2)

        ########### Fluorophore Positions ############
        #sbsizer=wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Fluorophore Postions'),
        #                          wx.VERTICAL)

        item = afp.foldingPane(self,
                               -1,
                               caption='Fluorophore Postions',
                               pinned=True)
        pane = wx.Panel(item, -1)
        sbsizer = wx.BoxSizer(wx.VERTICAL)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.tNumFluorophores = wx.TextCtrl(pane,
                                            -1,
                                            value='10000',
                                            size=(60, -1))
        hsizer.Add(self.tNumFluorophores, 0,
                   wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        hsizer.Add(
            wx.StaticText(pane, -1, 'fluorophores distributed evenly along'),
            0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.tKbp = wx.TextCtrl(pane, -1, size=(60, -1), value='200000')
        hsizer.Add(self.tKbp, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        hsizer.Add(wx.StaticText(pane, -1, 'nm'), 0,
                   wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        hsizer.AddStretchSpacer()

        self.bGenWormlike = wx.Button(pane, -1, 'Generate')
        self.bGenWormlike.Bind(wx.EVT_BUTTON, self.OnBGenWormlikeButton)
        hsizer.Add(self.bGenWormlike, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                   2)

        sbsizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 2)
        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        hsizer.Add(wx.StaticText(pane, -1, 'Persistence length [nm]:'), 0,
                   wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)
        self.tPersist = wx.TextCtrl(pane, -1, size=(60, -1), value='1500')
        hsizer.Add(self.tPersist, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        hsizer.Add(wx.StaticText(pane, -1, 'Z scale:'), 0,
                   wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)
        self.tZScale = wx.TextCtrl(pane, -1, size=(60, -1), value='1.0')
        hsizer.Add(self.tZScale, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.cbFlatten = wx.CheckBox(pane, -1, 'flatten (set z to 0)')
        self.cbFlatten.SetValue(False)
        hsizer.Add(self.cbFlatten, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        sbsizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 2)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.cbColour = wx.CheckBox(pane, -1, u'Colourful')
        self.cbColour.SetValue(False)
        hsizer.Add(self.cbColour, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.cbWrap = wx.CheckBox(pane, -1, u'Wrap at FOV edge')
        self.cbWrap.SetValue(True)
        hsizer.Add(self.cbWrap, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        sbsizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 2)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.stCurObjPoints = wx.StaticText(pane, -1,
                                            'Current object has NO points')
        self.stCurObjPoints.SetForegroundColour(wx.RED)
        hsizer.Add(self.stCurObjPoints, 0, wx.ALL, 2)
        hsizer.AddStretchSpacer()

        self.bLoadPoints = wx.Button(pane, -1, 'Load From File')
        self.bLoadPoints.Bind(wx.EVT_BUTTON, self.OnBLoadPointsButton)
        hsizer.Add(self.bLoadPoints, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.bSavePoints = wx.Button(pane, -1, 'Save To File')
        self.bSavePoints.Bind(wx.EVT_BUTTON, self.OnBSavePointsButton)
        hsizer.Add(self.bSavePoints, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        sbsizer.Add(hsizer, 0, wx.ALL | wx.EXPAND, 2)

        pane.SetSizerAndFit(sbsizer)
        item.AddNewElement(pane)
        self.AddPane(item)
        #vsizer.Add(sbsizer, 0, wx.ALL|wx.EXPAND, 2)

        ################ Virtual Fluorophores ###########

        #sbsizer=wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Generate Virtual Fluorophores'),
        #                          wx.VERTICAL)

        item = afp.foldingPane(self,
                               -1,
                               caption='Fluorophore switching model',
                               pinned=True)
        pane = wx.Panel(item, -1)
        sbsizer = wx.BoxSizer(wx.VERTICAL)

        self.nSimulationType = wx.Notebook(pane, -1)

        ######################## Based on first principles... #########
        pFirstPrinciples = wx.Panel(self.nSimulationType, -1)
        pFirstPrinciplesSizer = wx.BoxSizer(wx.VERTICAL)

        sbsizer2 = wx.StaticBoxSizer(
            wx.StaticBox(pFirstPrinciples, -1, 'Transition Tensor'),
            wx.VERTICAL)

        self.nTransitionTensor = wx.Notebook(pFirstPrinciples, -1)
        # self.nTransitionTensor.SetLabel('Transition Probabilites')

        #pFirstPrinciplesSizer.Add(wx.StaticText(pFirstPrinciples, -1, "A 4-state 1st order kinetic model, this allows simulation of all common modalities (PALM, STORM, PAINT, etc ...) with suitable parameter choices"), 0, wx.ALL, 2)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        hsizer.Add(wx.StaticText(pFirstPrinciples, -1, 'Generate matrix for:'),
                   0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL, 2)

        self.cModelPresets = wx.Choice(pFirstPrinciples,
                                       -1,
                                       choices=['STORM', 'PALM', 'PAINT'])
        self.cModelPresets.Bind(wx.EVT_CHOICE, self.OnModelPresets)

        hsizer.Add(self.cModelPresets, 0, wx.ALL | wx.ALIGN_CENTRE_HORIZONTAL,
                   2)

        sbsizer2.Add(hsizer, 0, wx.ALL, 2)

        self.gSpontan = wx.grid.Grid(self.nTransitionTensor, -1)
        self.gSwitch = wx.grid.Grid(self.nTransitionTensor, -1)
        self.gProbe = wx.grid.Grid(self.nTransitionTensor, -1)

        self._init_coll_nTransitionTensor_Pages(self.nTransitionTensor)

        self.setupGrid(self.gSpontan, self.states, self.stateTypes)
        self.setupGrid(self.gSwitch, self.states, self.stateTypes)
        self.setupGrid(self.gProbe, self.states, self.stateTypes)

        sbsizer2.Add(self.nTransitionTensor, 1, wx.EXPAND | wx.ALL, 2)
        pFirstPrinciplesSizer.Add(sbsizer2, 1, wx.EXPAND | wx.ALL, 2)

        sbsizer2 = wx.StaticBoxSizer(
            wx.StaticBox(pFirstPrinciples, -1,
                         'Excitation Crossections (Fluorophore Brightness)'),
            wx.HORIZONTAL)

        sbsizer2.Add(wx.StaticText(pFirstPrinciples, -1, 'Switching Laser:'),
                     0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.tExSwitch = wx.TextCtrl(pFirstPrinciples, -1, value='1')
        sbsizer2.Add(self.tExSwitch, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        sbsizer2.Add(
            wx.StaticText(pFirstPrinciples, -1,
                          'photons/mWs     Probe Laser:'), 0,
            wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.tExProbe = wx.TextCtrl(pFirstPrinciples, -1, value='100')
        sbsizer2.Add(self.tExProbe, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        sbsizer2.Add(wx.StaticText(pFirstPrinciples, -1, 'photons/mWs'), 0,
                     wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        self.sbsizer2 = sbsizer2

        pFirstPrinciplesSizer.Add(sbsizer2, 0, wx.EXPAND | wx.ALL, 2)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.bGenFlours = wx.Button(pFirstPrinciples, -1, 'Go')
        self.bGenFlours.Bind(wx.EVT_BUTTON, self.OnBGenFloursButton)
        hsizer.Add(self.bGenFlours, 1, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 2)

        pFirstPrinciplesSizer.Add(hsizer, 0, wx.ALL | wx.ALIGN_RIGHT, 2)
        pFirstPrinciples.SetSizer(pFirstPrinciplesSizer)

        ######################## Based on empirical data... #########

        pEmpiricalModel = wx.Panel(self.nSimulationType, -1)
        pEmpiricalModelSizer = wx.BoxSizer(wx.VERTICAL)

        sbsizer2 = wx.StaticBoxSizer(
            wx.StaticBox(pEmpiricalModel, -1,
                         'Load Dye Kinetics Histogram (JSON)'), wx.HORIZONTAL)

        self.stEmpiricalHist = wx.StaticText(pEmpiricalModel, -1, 'File: ')
        sbsizer2.Add(self.stEmpiricalHist, 0, wx.ALL, 2)
        sbsizer2.AddStretchSpacer()

        self.bLoadEmpiricalHist = wx.Button(pEmpiricalModel, -1, 'Load')
        self.bLoadEmpiricalHist.Bind(wx.EVT_BUTTON,
                                     self.OnBLoadEmpiricalHistButton)
        sbsizer2.Add(self.bLoadEmpiricalHist, 0,
                     wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 2)

        pEmpiricalModelSizer.Add(sbsizer2, 0, wx.ALL | wx.EXPAND, 2)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)

        self.bGenEmpiricalHistFluors = wx.Button(pEmpiricalModel, -1, 'Go')
        self.bGenEmpiricalHistFluors.Bind(wx.EVT_BUTTON,
                                          self.OnBGenEmpiricalHistFluorsButton)
        hsizer.Add(self.bGenEmpiricalHistFluors, 1,
                   wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 2)

        pEmpiricalModelSizer.Add(hsizer, 0, wx.ALL | wx.ALIGN_RIGHT, 2)

        pEmpiricalModel.SetSizer(pEmpiricalModelSizer)

        self.pFirstPrinciples = pFirstPrinciples
        self.pEmpericalModel = pEmpiricalModel

        self.nSimulationType.AddPage(imageId=-1,
                                     page=pFirstPrinciples,
                                     select=True,
                                     text='Theoretical State Model')
        self.nSimulationType.AddPage(imageId=-1,
                                     page=pEmpiricalModel,
                                     select=False,
                                     text='Data Based Empirical Model')
        sbsizer.Add(self.nSimulationType, 0, wx.ALL | wx.EXPAND, 2)

        #vsizer.Add(sbsizer, 0, wx.ALL | wx.EXPAND, 2)
        pane.SetSizerAndFit(sbsizer)
        item.AddNewElement(pane)
        self.AddPane(item)

        ######## Status #########

        #sbsizer=wx.StaticBoxSizer(wx.StaticBox(self, -1, 'Status'),
        #                          wx.VERTICAL)

        item = afp.foldingPane(self, -1, caption='Status', pinned=True)
        pane = wx.Panel(item, -1)
        sbsizer = wx.BoxSizer(wx.VERTICAL)

        self.stStatus = wx.StaticText(pane, -1, label='hello\nworld\n\n\nfoo')
        sbsizer.Add(self.stStatus, 0, wx.ALL | wx.EXPAND, 2)

        self.bPause = wx.Button(pane, -1, 'Pause')
        self.bPause.Bind(wx.EVT_BUTTON, self.OnBPauseButton)
        sbsizer.Add(self.bPause, 0, wx.ALL | wx.ALIGN_RIGHT, 2)

        pane.SetSizerAndFit(sbsizer)
        item.AddNewElement(pane)
        self.AddPane(item)
Example #24
0
    def __init__(self, parent):
        """
			Constructor.
		"""
        wx.Panel.__init__(self, parent)

        ### FileBrowse
        self.plugin_dir = filebrowse.DirBrowseButton(
            self,
            wx.ID_ANY,
            labelText=_("Plug-ins directory:"),
            toolTip=_("Change the plug-ins directory"),
            dialogTitle=_("Plugins directory..."))
        self.domain_dir = filebrowse.DirBrowseButton(
            self,
            wx.ID_ANY,
            labelText=_("Library directory:"),
            toolTip=_("Change the library directory"),
            dialogTitle=_("Libraries directory..."))
        self.out_dir = filebrowse.DirBrowseButton(
            self,
            wx.ID_ANY,
            labelText=_("Output directory:"),
            toolTip=_("Change the output directory"),
            dialogTitle=_("Output directory..."))

        self.plugin_dir.SetValue(PLUGINS_PATH)
        self.domain_dir.SetValue(DOMAIN_PATH)
        self.out_dir.SetValue(OUT_DIR)

        ### StaticText
        self.st1 = wx.StaticText(self, wx.ID_ANY, _("Number of recent file:"))
        self.st2 = wx.StaticText(self, wx.ID_ANY, _("Font size:"))
        self.st3 = wx.StaticText(self, wx.ID_ANY, _("Deep of history item:"))
        self.st4 = wx.StaticText(self, wx.ID_ANY, _("wxPython version:"))

        self.st1.SetToolTipString(
            _("Feel free to change the length of list defining the recent opened files."
              ))
        self.st2.SetToolTipString(
            _("Feel free to change the font size of DEVSimpy."))
        self.st3.SetToolTipString(
            _("Feel free to change the number of item for undo/redo command"))
        self.st4.SetToolTipString(
            _("Feel free to change the version of wxpython used loaded by DEVSimPy"
              ))

        ### number of opened file
        self.nb_opened_file = wx.SpinCtrl(self, wx.ID_ANY, '')
        self.nb_opened_file.SetRange(2, 20)
        self.nb_opened_file.SetValue(NB_OPENED_FILE)

        ### Block font size
        self.font_size = wx.SpinCtrl(self, wx.ID_ANY, '')
        self.font_size.SetRange(2, 20)
        self.font_size.SetValue(FONT_SIZE)

        ### number of undo/redo items
        self.nb_history_undo = wx.SpinCtrl(self, wx.ID_ANY, '')
        self.nb_history_undo.SetRange(2, 100)
        self.nb_history_undo.SetValue(NB_HISTORY_UNDO)

        ### CheckBox
        self.cb1 = wx.CheckBox(self, wx.ID_ANY, _('Transparency'))
        self.cb1.SetToolTipString(
            _("Transparency for the detached frame of diagrams"))
        self.cb1.SetValue(__builtin__.__dict__['TRANSPARENCY'])

        ### wxPython version
        wxv = map(lambda a: a.split('-')[0], wxversion.getInstalled())

        self.cb2 = wx.ComboBox(self,
                               wx.ID_ANY,
                               GetWXVersionFromIni(),
                               choices=wxv,
                               style=wx.CB_READONLY)
        self.cb2.SetToolTipString(_("Default version of wxPython."))
        self.default_wxv = self.cb2.GetValue()

        ### Sizer
        box1 = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY,
                                              _('Properties')),
                                 orient=wx.VERTICAL)
        vsizer = wx.BoxSizer(wx.VERTICAL)
        hsizer = wx.GridSizer(4, 2, 20, 20)

        hsizer.AddMany([
            (self.st1, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.nb_opened_file, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.st3, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.nb_history_undo, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.st2, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.font_size, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.st4, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5),
            (self.cb2, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)
        ])

        vsizer.Add(self.plugin_dir, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
        vsizer.Add(self.domain_dir, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
        vsizer.Add(self.out_dir, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
        vsizer.Add(hsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
        vsizer.Add(self.cb1, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
        box1.Add(vsizer, 1, wx.EXPAND)

        ### Set sizer
        self.SetSizer(box1)
        self.SetAutoLayout(True)
Example #25
0
    def __init__(self, parent, dialog):
        wx.Panel.__init__(self, parent, -1)
        
        self.dialog = dialog
        self.utility = dialog.utility

        outerbox = wx.BoxSizer(wx.VERTICAL)

        announcesection_title = wx.StaticBox(self, -1, self.utility.lang.get('announce'))
        announcesection = wx.StaticBoxSizer(announcesection_title, wx.VERTICAL)

        self.announcehistory = []

        # Use internal tracker?
        itracker_box = wx.BoxSizer(wx.HORIZONTAL)
        prompt = self.utility.lang.get('useinternaltracker')+' ('+self.utility.session.get_internal_tracker_url()+')'
        self.itracker = wx.CheckBox(self, -1, prompt)
        wx.EVT_CHECKBOX(self, self.itracker.GetId(), self.OnInternalTracker)
        itracker_box.Add(self.itracker, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
        announcesection.Add(itracker_box, 0, wx.EXPAND|wx.ALL, 3)

        # Manual override of tracker definition
        manualover_box = wx.BoxSizer(wx.HORIZONTAL)
        self.manualover = wx.CheckBox(self, -1, self.utility.lang.get('manualtrackerconfig'))
        wx.EVT_CHECKBOX(self, self.manualover.GetId(), self.OnInternalTracker) # yes, OnInternalTracker
        manualover_box.Add(self.manualover, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
        announcesection.Add(manualover_box, 0, wx.EXPAND|wx.ALL, 3)

        # Copy announce from torrent
        self.copybutton = wx.Button(self, -1, self.utility.lang.get('copyannouncefromtorrent'))
        wx.EVT_BUTTON(self, self.copybutton.GetId(), self.announceCopy)
        announcesection.Add(self.copybutton, 0, wx.ALL, 5)

        # Announce url:
        self.annText = wx.StaticText(self, -1, self.utility.lang.get('announceurl'))
        announcesection.Add(self.annText, 0, wx.ALL, 5)

        announceurl_box = wx.BoxSizer(wx.HORIZONTAL)
       
        self.annCtl = wx.ComboBox(self, -1, "", choices = self.announcehistory, style=wx.CB_DROPDOWN)
        announceurl_box.Add(self.annCtl, 1, wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, 5)
        
        self.addbutton = wx.Button(self, -1, "+", size = (30, -1))
        self.addbutton.SetToolTipString(self.utility.lang.get('add'))
        wx.EVT_BUTTON(self, self.addbutton.GetId(), self.addAnnounce)
        announceurl_box.Add(self.addbutton, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3)

        self.delbutton = wx.Button(self, -1, "-", size = (30, -1))
        self.delbutton.SetToolTipString(self.utility.lang.get('remove'))
        wx.EVT_BUTTON(self, self.delbutton.GetId(), self.removeAnnounce)
        announceurl_box.Add(self.delbutton, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 3)

        announcesection.Add(announceurl_box, 0, wx.EXPAND)

        # Announce List:        
        self.annListText = wx.StaticText(self, -1, self.utility.lang.get('announcelist'))
        announcesection.Add(self.annListText, 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
       
        self.annListCtl = wx.TextCtrl(self, -1, size = (-1, 75), style = wx.TE_MULTILINE|wx.HSCROLL|wx.TE_DONTWRAP)
        self.annListCtl.SetToolTipString(self.utility.lang.get('multiannouncehelp'))
        
        announcesection.Add(self.annListCtl, 1, wx.EXPAND|wx.TOP, 5)
        
        outerbox.Add(announcesection, 0, wx.EXPAND|wx.ALL, 3)
      
        # HTTP Seeds:
        outerbox.Add(wx.StaticText(self, -1, self.utility.lang.get('httpseeds')), 0, wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)
       
        self.httpSeeds = wx.TextCtrl(self, -1, size = (-1, 75), style = wx.TE_MULTILINE|wx.HSCROLL|wx.TE_DONTWRAP)
        self.httpSeeds.SetToolTipString(self.utility.lang.get('httpseedshelp'))
        outerbox.Add(self.httpSeeds, 1, wx.EXPAND|wx.ALL, 5)
      
        self.SetSizerAndFit(outerbox)
        
        self.loadValues()
Example #26
0
    def __do_layout(self):
        grid_sizer_base = wx.FlexGridSizer(rows=3, cols=1, vgap=10, hgap=10)
        grid_sizer_contenu = wx.FlexGridSizer(rows=1, cols=2, vgap=10, hgap=10)

        # Colonne gauche
        grid_sizer_gauche = wx.FlexGridSizer(rows=2, cols=1, vgap=10, hgap=10)

        # Box Généralités
        box_generalites = wx.StaticBoxSizer(self.box_generalites_staticbox,
                                            wx.VERTICAL)
        grid_sizer_generalites = wx.FlexGridSizer(rows=4,
                                                  cols=2,
                                                  vgap=10,
                                                  hgap=10)
        grid_sizer_generalites.Add(self.label_label, 0,
                                   wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                                   0)
        grid_sizer_generalites.Add(self.ctrl_label, 0, wx.EXPAND, 0)
        grid_sizer_generalites.Add(self.label_categorie, 0,
                                   wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                                   0)
        grid_sizer_generalites.Add(self.ctrl_categorie, 0, wx.EXPAND, 0)
        grid_sizer_generalites.Add(self.label_controle, 0,
                                   wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                                   0)
        grid_sizer_generalites.Add(self.ctrl_controle, 0, wx.EXPAND, 0)
        grid_sizer_generalites.Add(self.label_visible, 0,
                                   wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL,
                                   0)
        grid_sizer_generalites.Add(self.ctrl_visible, 0, 0, 0)
        grid_sizer_generalites.AddGrowableCol(1)
        box_generalites.Add(grid_sizer_generalites, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_gauche.Add(box_generalites, 1, wx.EXPAND, 0)

        # Box Apercu
        box_apercu = wx.StaticBoxSizer(self.box_apercu_staticbox, wx.VERTICAL)
        grid_sizer_apercu = wx.FlexGridSizer(rows=2, cols=1, vgap=10, hgap=10)
        grid_sizer_apercu.Add(self.ctrl_apercu, 0, wx.EXPAND, 0)
        grid_sizer_apercu.AddGrowableRow(0)
        grid_sizer_apercu.AddGrowableCol(0)
        box_apercu.Add(grid_sizer_apercu, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_gauche.Add(box_apercu, 1, wx.EXPAND, 0)

        grid_sizer_gauche.AddGrowableRow(1)
        grid_sizer_gauche.AddGrowableCol(0)
        grid_sizer_contenu.Add(grid_sizer_gauche, 1, wx.EXPAND, 0)

        # Colonne droite
        grid_sizer_droite = wx.FlexGridSizer(rows=2, cols=1, vgap=10, hgap=10)

        # Box choix
        box_choix = wx.StaticBoxSizer(self.box_choix_staticbox, wx.VERTICAL)
        grid_sizer_choix = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)
        grid_sizer_choix.Add(self.ctrl_choix, 0, wx.EXPAND, 0)

        grid_sizer_boutons_choix = wx.FlexGridSizer(rows=6,
                                                    cols=1,
                                                    vgap=5,
                                                    hgap=5)
        grid_sizer_boutons_choix.Add(self.bouton_ajouter_choix, 0, 0, 0)
        grid_sizer_boutons_choix.Add(self.bouton_modifier_choix, 0, 0, 0)
        grid_sizer_boutons_choix.Add(self.bouton_supprimer_choix, 0, 0, 0)
        grid_sizer_boutons_choix.Add((5, 5), 0, 0, 0)
        grid_sizer_boutons_choix.Add(self.bouton_monter_choix, 0, 0, 0)
        grid_sizer_boutons_choix.Add(self.bouton_descendre_choix, 0, 0, 0)
        grid_sizer_choix.Add(grid_sizer_boutons_choix, 1, wx.EXPAND, 0)

        grid_sizer_choix.AddGrowableRow(0)
        grid_sizer_choix.AddGrowableCol(0)
        box_choix.Add(grid_sizer_choix, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_droite.Add(box_choix, 1, wx.EXPAND, 0)

        # Box Options
        box_options = wx.StaticBoxSizer(self.box_options_staticbox,
                                        wx.VERTICAL)
        grid_sizer_options = wx.FlexGridSizer(rows=3, cols=2, vgap=10, hgap=10)
        grid_sizer_options = wx.FlexGridSizer(rows=4, cols=2, vgap=10, hgap=10)
        grid_sizer_options.Add(self.label_hauteur, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_options.Add(self.ctrl_hauteur, 0, wx.EXPAND, 0)
        grid_sizer_options.Add(self.label_valmin, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_options.Add(self.ctrl_valmin, 0, wx.EXPAND, 0)
        grid_sizer_options.Add(self.label_valmax, 0,
                               wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 0)
        grid_sizer_options.Add(self.ctrl_valmax, 0, wx.EXPAND, 0)
        grid_sizer_options.AddGrowableCol(1)
        box_options.Add(grid_sizer_options, 1, wx.ALL | wx.EXPAND, 5)
        grid_sizer_droite.Add(box_options, 1, wx.EXPAND, 0)
        grid_sizer_droite.AddGrowableRow(0)
        grid_sizer_droite.AddGrowableCol(0)

        grid_sizer_contenu.Add(grid_sizer_droite, 1, wx.EXPAND, 0)
        grid_sizer_contenu.AddGrowableRow(0)
        grid_sizer_contenu.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_contenu, 1,
                            wx.LEFT | wx.RIGHT | wx.TOP | wx.EXPAND, 10)

        # Boutons
        grid_sizer_boutons = wx.FlexGridSizer(rows=1, cols=4, vgap=10, hgap=10)
        grid_sizer_boutons.Add(self.bouton_aide, 0, 0, 0)
        grid_sizer_boutons.Add((20, 20), 0, wx.EXPAND, 0)
        grid_sizer_boutons.Add(self.bouton_ok, 0, 0, 0)
        grid_sizer_boutons.Add(self.bouton_annuler, 0, 0, 0)
        grid_sizer_boutons.AddGrowableCol(1)
        grid_sizer_base.Add(grid_sizer_boutons, 1,
                            wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, 10)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        grid_sizer_base.AddGrowableRow(0)
        grid_sizer_base.AddGrowableCol(0)
        self.Layout()
        self.CenterOnScreen()
Example #27
0
    def LayoutItems(self):

        leftbottomsizer_staticbox = wx.StaticBox(self.panel, -1, "Play With Me!")
        lefttopsizer_staticbox = wx.StaticBox(self.panel, -1, "Change My Properties!")

        self.knob1 = KC.KnobCtrl(self.panel, -1, size=(100, 100))
        self.knob2 = KC.KnobCtrl(self.panel, -1, size=(100, 100))

        self.knob1.SetTags(range(0, 151, 10))
        self.knob1.SetAngularRange(-45, 225)
        self.knob1.SetValue(45)

        self.knob2.SetTags(range(0, 151, 10))
        self.knob2.SetAngularRange(0, 270)
        self.knob2.SetValue(100)

        self.knobtracker1 = wx.StaticText(self.panel, -1, "Value = 45")
        self.knobtracker2 = wx.StaticText(self.panel, -1, "Value = 100")

        knobslider = wx.Slider(self.panel, -1, 4, 1, 10, style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS|wx.SL_LABELS)
        tickslider = wx.Slider(self.panel, -1, 16, 3, 20, style=wx.SL_HORIZONTAL|wx.SL_AUTOTICKS|wx.SL_LABELS)
        tagscolour = csel.ColourSelect(self.panel, -1, "Choose...", wx.BLACK)
        boundingcolour = csel.ColourSelect(self.panel, -1, "Choose...", wx.WHITE)
        firstcolour = csel.ColourSelect(self.panel, -1, "Choose...", wx.WHITE)
        secondcolour = csel.ColourSelect(self.panel, -1, "Choose...", wx.Colour(170, 170, 150))

        knobslider.SetValue(4)
        tickslider.SetValue(16)

        mainsizer = wx.BoxSizer(wx.VERTICAL)
        panelsizer = wx.BoxSizer(wx.HORIZONTAL)
        rightsizer = wx.FlexGridSizer(6, 2, 10, 10)
        leftsizer = wx.BoxSizer(wx.VERTICAL)
        leftbottomsizer = wx.StaticBoxSizer(leftbottomsizer_staticbox, wx.VERTICAL)
        lefttopsizer = wx.StaticBoxSizer(lefttopsizer_staticbox, wx.VERTICAL)
        
        lefttopsizer.Add(self.knob1, 1, wx.ALL|wx.EXPAND, 5)
        lefttopsizer.Add(self.knobtracker1, 0, wx.ALL, 5)
        leftsizer.Add(lefttopsizer, 1, wx.ALL|wx.EXPAND, 5)
        leftbottomsizer.Add(self.knob2, 1, wx.ALL|wx.EXPAND, 5)
        leftbottomsizer.Add(self.knobtracker2, 0, wx.ALL, 5)
        leftsizer.Add(leftbottomsizer, 1, wx.ALL|wx.EXPAND, 5)
        panelsizer.Add(leftsizer, 1, wx.EXPAND|wx.ALL, 20)
        
        label_1 = wx.StaticText(self.panel, -1, "Knob Radius: ")
        rightsizer.Add(label_1, 0, wx.ALIGN_CENTER_VERTICAL, 5)
        rightsizer.Add(knobslider, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        label_2 = wx.StaticText(self.panel, -1, "Number Of Ticks: ")
        rightsizer.Add(label_2, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        rightsizer.Add(tickslider, 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
        label_3 = wx.StaticText(self.panel, -1, "Tags Colour: ")
        rightsizer.Add(label_3, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        rightsizer.Add(tagscolour, 0)
        label_4 = wx.StaticText(self.panel, -1, "Bounding Colour: ")
        rightsizer.Add(label_4, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        rightsizer.Add(boundingcolour, 0)
        label_5 = wx.StaticText(self.panel, -1, "First Gradient Colour: ")
        rightsizer.Add(label_5, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        rightsizer.Add(firstcolour, 0)
        label_6 = wx.StaticText(self.panel, -1, "Second Gradient Colour: ")
        rightsizer.Add(label_6, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        rightsizer.Add(secondcolour, 0)
        panelsizer.Add(rightsizer, 1, wx.ALL|wx.EXPAND, 20)

        self.panel.SetSizer(panelsizer)
        panelsizer.Layout()

        mainsizer.Add(self.panel, 1, wx.EXPAND)
        self.SetSizer(mainsizer)
        mainsizer.Layout()
        
        self.Bind(wx.EVT_COMMAND_SCROLL, self.OnKnobRadius, knobslider)
        self.Bind(wx.EVT_COMMAND_SCROLL, self.OnTicks, tickslider)
        self.Bind(KC.EVT_KC_ANGLE_CHANGED, self.OnAngleChanged1, self.knob1)
        self.Bind(KC.EVT_KC_ANGLE_CHANGED, self.OnAngleChanged2, self.knob2)
        tagscolour.Bind(csel.EVT_COLOURSELECT, self.OnTagsColour)
        boundingcolour.Bind(csel.EVT_COLOURSELECT, self.OnBoundingColour)
        firstcolour.Bind(csel.EVT_COLOURSELECT, self.OnFirstColour)
        secondcolour.Bind(csel.EVT_COLOURSELECT, self.OnSecondColour)
Example #28
0
		def __init__(self):

			self.conf = Conf()
			self.home = self.conf.home
			self.currentpath = self.home+self.conf.get('GENERAL', 'op_folder')+'/openplotter'

			Language(self.conf)

			title = _('Calculate')

			wx.Frame.__init__(self, None, title=title, size=(690,400))
			
			self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
			
			self.icon = wx.Icon(self.currentpath+'/openplotter.ico', wx.BITMAP_TYPE_ICO)
			self.SetIcon(self.icon)

			rate_list = ['0.1', '0.25', '0.5', '0.75', '1', '1.5', '2', '5', '30', '60', '300']

			panel = wx.Panel(self)

			mg_box = wx.StaticBox(panel, -1, _(' Magnetic variation '))
			self.mag_var = wx.CheckBox(panel, -1, label=_('Enable'))
			mg_requires = wx.StaticText(panel, label=_('Requires: position, date.'))
			mg_accu_label = wx.StaticText(panel, label=_('Accuracy (sec)'))
			self.mg_accu= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)
			mg_rate_label = wx.StaticText(panel, label=_('Rate (sec)'))
			self.mg_rate= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)

			rt_box = wx.StaticBox(panel, -1, _(' Rate of turn '))
			self.rate_turn = wx.CheckBox(panel, -1, label=_('Enable'))
			rt_requires = wx.StaticText(panel, label=_('Requires: magnetic heading.'))
			rt_accu_label = wx.StaticText(panel, label=_('Accuracy (sec)'))
			self.rt_accu= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)
			rt_rate_label = wx.StaticText(panel, label=_('Rate (sec)'))
			self.rt_rate= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)

			th_box = wx.StaticBox(panel, -1, _(' True heading '))
			self.heading_t = wx.CheckBox(panel, -1, label=_('Deviation is included'))
			self.heading_t.Bind(wx.EVT_CHECKBOX, self.on_select_th)
			th_requires = wx.StaticText(panel, label=_('Requires: magnetic heading, variation.'))
			self.add_deviation = wx.CheckBox(panel, -1, label=_('Add deviation table'))
			self.add_deviation.Bind(wx.EVT_CHECKBOX, self.on_select_th)
			th_requires2 = wx.StaticText(panel, label=_('Requires: magnetic heading, variation, deviation.'))
			th_accu_label = wx.StaticText(panel, label=_('Accuracy (sec)'))
			self.th_accu= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)
			th_rate_label = wx.StaticText(panel, label=_('Rate (sec)'))
			self.th_rate= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)

			tw_box = wx.StaticBox(panel, -1, _(' True wind speed and direction '))
			self.true_wind = wx.CheckBox(panel, -1, label=_('Use Speed Through Water'))
			self.true_wind.Bind(wx.EVT_CHECKBOX, self.on_select_tw)
			tw_requires = wx.StaticText(panel, label=_('Requires: SignalK STW, AWS, AWA.'))
			self.true_wind2 = wx.CheckBox(panel, -1, label=_('Use Speed Over Ground'))
			self.true_wind2.Bind(wx.EVT_CHECKBOX, self.on_select_tg)
			tw_requires2 = wx.StaticText(panel, label=_('Requires: SignalK SOG, COG, HDT, AWS, AWA.'))
			tw_accu_label = wx.StaticText(panel, label=_('Accuracy (sec)'))
			self.tw_accu= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)
			tw_rate_label = wx.StaticText(panel, label=_('Rate (sec)'))
			self.tw_rate= wx.ComboBox(panel, choices=rate_list, style=wx.CB_READONLY)

			button_cancel =wx.Button(panel, label=_('Cancel'))
			self.Bind(wx.EVT_BUTTON, self.on_cancel, button_cancel)

			button_ok =wx.Button(panel, label=_('OK'))
			self.Bind(wx.EVT_BUTTON, self.on_ok, button_ok)

			#self.true_wind.Disable()
			#self.true_wind2.Disable()

			mg_boxSizer = wx.StaticBoxSizer(mg_box, wx.VERTICAL)
			mg_boxSizer.Add(self.mag_var, 0, wx.ALL | wx.EXPAND, 5)
			mg_boxSizer.Add(mg_requires, 0, wx.LEFT | wx.EXPAND, 5)
			mg_h = wx.BoxSizer(wx.HORIZONTAL)
			mg_h.Add(mg_rate_label, 0, wx.UP | wx.EXPAND, 10)
			mg_h.Add(self.mg_rate, 0, wx.ALL | wx.EXPAND, 5)
			mg_h.Add(mg_accu_label, 0, wx.UP | wx.EXPAND, 10)
			mg_h.Add(self.mg_accu, 0, wx.ALL | wx.EXPAND, 5)
			mg_boxSizer.Add(mg_h, 0, wx.ALL | wx.EXPAND, 5)

			rt_boxSizer = wx.StaticBoxSizer(rt_box, wx.VERTICAL)
			rt_boxSizer.Add(self.rate_turn, 0, wx.ALL | wx.EXPAND, 5)
			rt_boxSizer.Add(rt_requires, 0, wx.LEFT | wx.EXPAND, 5)
			rt_h = wx.BoxSizer(wx.HORIZONTAL)
			rt_h.Add(rt_rate_label, 0, wx.UP | wx.EXPAND, 10)
			rt_h.Add(self.rt_rate, 0, wx.ALL | wx.EXPAND, 5)
			rt_h.Add(rt_accu_label, 0, wx.UP | wx.EXPAND, 10)
			rt_h.Add(self.rt_accu, 0, wx.ALL | wx.EXPAND, 5)
			rt_boxSizer.Add(rt_h, 0, wx.ALL | wx.EXPAND, 5)

			th_boxSizer = wx.StaticBoxSizer(th_box, wx.VERTICAL)
			th_boxSizer.Add(self.heading_t, 0, wx.ALL | wx.EXPAND, 5)
			th_boxSizer.Add(th_requires, 0, wx.LEFT | wx.EXPAND, 5)
			th_boxSizer.Add(self.add_deviation, 0, wx.ALL | wx.EXPAND, 5)
			th_boxSizer.Add(th_requires2, 0, wx.LEFT | wx.EXPAND, 5)
			th_h = wx.BoxSizer(wx.HORIZONTAL)
			th_h.Add(th_rate_label, 0, wx.UP | wx.EXPAND, 10)
			th_h.Add(self.th_rate, 0, wx.ALL | wx.EXPAND, 5)
			th_h.Add(th_accu_label, 0, wx.UP | wx.EXPAND, 10)
			th_h.Add(self.th_accu, 0, wx.ALL | wx.EXPAND, 5)
			th_boxSizer.Add(th_h, 0, wx.ALL | wx.EXPAND, 5)

			tw_boxSizer = wx.StaticBoxSizer(tw_box, wx.VERTICAL)
			tw_boxSizer.Add(self.true_wind, 0, wx.ALL | wx.EXPAND, 5)
			tw_boxSizer.Add(tw_requires, 0, wx.LEFT | wx.EXPAND, 5)
			tw_boxSizer.Add(self.true_wind2, 0, wx.ALL | wx.EXPAND, 5)
			tw_boxSizer.Add(tw_requires2, 0, wx.LEFT | wx.EXPAND, 5)
			tw_h = wx.BoxSizer(wx.HORIZONTAL)
			tw_h.Add(tw_rate_label, 0, wx.UP | wx.EXPAND, 10)
			tw_h.Add(self.tw_rate, 0, wx.ALL | wx.EXPAND, 5)
			tw_h.Add(tw_accu_label, 0, wx.UP | wx.EXPAND, 10)
			tw_h.Add(self.tw_accu, 0, wx.ALL | wx.EXPAND, 5)
			tw_boxSizer.Add(tw_h, 0, wx.ALL | wx.EXPAND, 5)

			vbox = wx.BoxSizer(wx.VERTICAL)
			vbox.Add(mg_boxSizer, 0, wx.ALL | wx.EXPAND, 5)
			vbox.Add(tw_boxSizer, 0, wx.ALL | wx.EXPAND, 5)

			vbox2 = wx.BoxSizer(wx.VERTICAL)
			vbox2.Add(th_boxSizer, 0, wx.ALL | wx.EXPAND, 5)
			vbox2.Add(rt_boxSizer, 0, wx.ALL | wx.EXPAND, 5)

			hbox = wx.BoxSizer(wx.HORIZONTAL)
			hbox.Add(vbox, 0, wx.ALL | wx.EXPAND, 0)
			hbox.Add(vbox2, 0, wx.ALL | wx.EXPAND, 0)

			hbox2 = wx.BoxSizer(wx.HORIZONTAL)
			hbox2.Add((0,0), 1, wx.ALL | wx.EXPAND, 0)
			hbox2.Add(button_cancel, 0, wx.ALL | wx.EXPAND, 10)
			hbox2.Add(button_ok, 0, wx.ALL | wx.EXPAND, 10)

			vbox3 = wx.BoxSizer(wx.VERTICAL)
			vbox3.Add(hbox, 0, wx.ALL | wx.EXPAND, 0)
			vbox3.Add(hbox2, 0, wx.ALL | wx.EXPAND, 0)

			panel.SetSizer(vbox3)

			self.Centre()

			if self.conf.get('CALCULATE', 'mag_var')=='1': self.mag_var.SetValue(True)
			self.mg_rate.SetValue(self.conf.get('CALCULATE', 'mag_var_rate'))
			self.mg_accu.SetValue(self.conf.get('CALCULATE', 'mag_var_accuracy'))

			if self.conf.get('CALCULATE', 'hdt')=='1': self.heading_t.SetValue(True)
			if self.conf.get('CALCULATE', 'hdt_dev')=='1': self.add_deviation.SetValue(True)
			#if self.conf.get('COMPASS', 'magnetic_h')=='1': self.add_deviation.Disable()

			self.th_rate.SetValue(self.conf.get('CALCULATE', 'hdt_rate'))
			self.th_accu.SetValue(self.conf.get('CALCULATE', 'hdt_accuracy'))

			if self.conf.get('CALCULATE', 'rot')=='1': self.rate_turn.SetValue(True)
			self.rt_rate.SetValue(self.conf.get('CALCULATE', 'rot_rate'))
			self.rt_accu.SetValue(self.conf.get('CALCULATE', 'rot_accuracy'))

			if self.conf.get('CALCULATE', 'tw_stw')=='1': self.true_wind.SetValue(True)
			if self.conf.get('CALCULATE', 'tw_sog')=='1': self.true_wind2.SetValue(True)
			self.tw_rate.SetValue(self.conf.get('CALCULATE', 'tw_rate'))
			self.tw_accu.SetValue(self.conf.get('CALCULATE', 'tw_accuracy'))
Example #29
0
    def __init__(self):
        wx.Frame.__init__(self,
                          parent=None,
                          title=u'量化软件',
                          size=(1500, 800),
                          style=wx.DEFAULT_FRAME_STYLE ^ wx.MAXIMIZE_BOX)
        #创建显示区面板
        self.DispPanel = MPL_Panel_Base(self)
        self.BackPanel = Loop_Panel_Base(self)
        self.am = self.DispPanel.am
        self.vol = self.DispPanel.vol
        self.devol = self.DispPanel.devol
        self.macd = self.DispPanel.macd

        #创建参数区面板
        self.ParaPanel = wx.Panel(self, -1)

        paraInput_Box = wx.StaticBox(self.ParaPanel, -1, u'参数输入')
        paraInput_Sizer = wx.StaticBoxSizer(paraInput_Box, wx.VERTICAL)
        self.StNameCodedict = {
            u"开山股份": "300257.SZ",
            u"浙大网新": "600797.SS",
            u"水晶光电": "002273.SZ",
            u"高鸿股份": "000851.SZ"
        }

        #初始化股票代码变量
        self.stockName_Val = u"开山股份"
        self.stockCode_Val = self.StNameCodedict[self.stockName_Val]

        self.stockName_CMBO = wx.ComboBox(
            self.ParaPanel,
            -1,
            self.stockName_Val,
            choices=list(self.StNameCodedict.keys()),
            style=wx.CB_READONLY | wx.CB_DROPDOWN)  #股票名称
        stockCode_Text = wx.StaticText(self.ParaPanel, -1, u'股票名称')

        #策略选取
        strate_Text = wx.StaticText(self.ParaPanel, -1, u'策略名称')
        strate_Combo_Val = [u"双趋势融合", u"阿尔法", u"布林带"]
        self.pickstrate_Val = u"双趋势融合"
        self.pickstrate_CMBO = wx.ComboBox(self.ParaPanel,
                                           -1,
                                           self.pickstrate_Val,
                                           choices=strate_Combo_Val,
                                           style=wx.CB_READONLY
                                           | wx.CB_DROPDOWN)  #策略名称

        #日历控件选择数据周期
        self.dpcEndTime = wx.DatePickerCtrl(
            self.ParaPanel,
            -1,
            style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE)  #结束时间
        self.dpcStartTime = wx.DatePickerCtrl(
            self.ParaPanel,
            -1,
            style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY | wx.DP_ALLOWNONE)  #起始时间
        DateTimeNow = wx.DateTime.Now()  #wx.DateTime格式"03/03/18 00:00:00"
        self.dpcEndTime.SetValue(DateTimeNow)
        DateTimeNow.SetYear(DateTimeNow.Year - 1)
        self.dpcStartTime.SetValue(DateTimeNow)
        stockData_Text = wx.StaticText(self.ParaPanel, -1, u'日期(Start-End)')

        #初始化时间变量
        dateVal = self.dpcStartTime.GetValue()
        self.stockSdate_Val = datetime.datetime(dateVal.Year,
                                                dateVal.Month + 1, dateVal.Day)
        dateVal = self.dpcEndTime.GetValue()
        self.stockEdate_Val = datetime.datetime(dateVal.Year,
                                                dateVal.Month + 1, dateVal.Day)

        paraInput_Sizer.Add(stockCode_Text,
                            proportion=0,
                            flag=wx.EXPAND | wx.ALL,
                            border=2)
        paraInput_Sizer.Add(self.stockName_CMBO, 0,
                            wx.EXPAND | wx.ALL | wx.CENTER, 2)
        paraInput_Sizer.Add(stockData_Text,
                            proportion=0,
                            flag=wx.EXPAND | wx.ALL,
                            border=2)
        paraInput_Sizer.Add(self.dpcStartTime, 0,
                            wx.EXPAND | wx.ALL | wx.CENTER, 2)
        paraInput_Sizer.Add(self.dpcEndTime, 0, wx.EXPAND | wx.ALL | wx.CENTER,
                            2)
        paraInput_Sizer.Add(strate_Text, 0, wx.EXPAND | wx.ALL | wx.CENTER, 2)
        paraInput_Sizer.Add(self.pickstrate_CMBO, 0,
                            wx.EXPAND | wx.ALL | wx.CENTER, 2)

        RadioList = ["不显示", "跳空缺口", "金叉/死叉", "N日突破"]
        self.StratInputBox = wx.RadioBox(self.ParaPanel,
                                         -1,
                                         label=u'指标提示',
                                         choices=RadioList,
                                         majorDimension=4,
                                         style=wx.RA_SPECIFY_ROWS)
        self.StratInputBox.Bind(wx.EVT_RADIOBOX, self.OnRadioBox_Indicator)
        #初始化指标变量
        self.IndicatInput_Val = self.StratInputBox.GetStringSelection()

        self.TextAInput = wx.TextCtrl(self.ParaPanel,
                                      -1,
                                      "交易信息提示:",
                                      style=wx.TE_MULTILINE
                                      | wx.TE_READONLY)  #多行|只读

        vboxnetA = wx.BoxSizer(wx.VERTICAL)  #纵向box
        vboxnetA.Add(paraInput_Sizer,
                     proportion=0,
                     flag=wx.EXPAND | wx.BOTTOM,
                     border=2)  #proportion参数控制容器尺寸比例
        vboxnetA.Add(self.StratInputBox,
                     proportion=0,
                     flag=wx.EXPAND | wx.BOTTOM,
                     border=2)
        vboxnetA.Add(self.TextAInput,
                     proportion=1,
                     flag=wx.EXPAND | wx.ALL,
                     border=2)
        self.ParaPanel.SetSizer(vboxnetA)

        #创建Right面板
        self.CtrlPanel = wx.Panel(self, -1)
        #创建FlexGridSizer布局网格
        self.FlexGridSizer = wx.FlexGridSizer(rows=3, cols=1, vgap=3, hgap=3)

        #行情按钮
        self.Firmoffer = wx.Button(self.CtrlPanel, -1, "行情")
        self.Firmoffer.Bind(wx.EVT_BUTTON, self.FirmEvent)  #绑定行情按钮事件
        #选股按钮
        self.Stockpick = wx.Button(self.CtrlPanel, -1, "选股")
        self.Stockpick.Bind(wx.EVT_BUTTON, self.PstockpEvent)  #绑定选股按钮事件
        #回测按钮
        self.Backtrace = wx.Button(self.CtrlPanel, -1, "回测")
        self.Backtrace.Bind(wx.EVT_BUTTON, self.BackEvent)  #绑定回测按钮事件

        #加入Sizer中
        self.FlexGridSizer.Add(self.Firmoffer,
                               proportion=1,
                               border=5,
                               flag=wx.ALL | wx.EXPAND)
        self.FlexGridSizer.Add(self.Stockpick,
                               proportion=1,
                               border=5,
                               flag=wx.ALL | wx.EXPAND)
        self.FlexGridSizer.Add(self.Backtrace,
                               proportion=1,
                               border=5,
                               flag=wx.ALL | wx.EXPAND)
        self.FlexGridSizer.SetFlexibleDirection(wx.BOTH)

        self.CtrlPanel.SetSizer(self.FlexGridSizer)

        self.HBoxPanel = wx.BoxSizer(wx.HORIZONTAL)
        self.HBoxPanel.Add(self.ParaPanel,
                           proportion=1.5,
                           border=2,
                           flag=wx.EXPAND | wx.ALL)
        self.HBoxPanel.Add(self.DispPanel,
                           proportion=8,
                           border=2,
                           flag=wx.EXPAND | wx.ALL)
        self.HBoxPanel.Add(self.CtrlPanel,
                           proportion=1,
                           border=2,
                           flag=wx.EXPAND | wx.ALL)
        self.SetSizer(self.HBoxPanel)
Example #30
0
    def __init__(self, parent):
        self.parent = parent
        wx.Panel.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        self.fileinfos = {}

        #add filenames ctrl
        self.filenames = CheckList.CheckList(
            self,
            columns=[
                (tr("Directory"), 200, 'left'),
                (tr("Source Filenames"), 350, 'left'),
                (tr("Results"), 300, 'left'),
            ],
            style=wx.LC_REPORT | wx.SUNKEN_BORDER)

        sizer.Add(self.filenames, 1, wx.ALL | wx.EXPAND, 2)

        box1 = wx.BoxSizer(wx.HORIZONTAL)
        self.ID_ADDFILES = wx.NewId()
        self.addfile = wx.Button(self, self.ID_ADDFILES, tr("Add Files"))
        box1.Add(self.addfile, 0, wx.ALL, 2)

        self.ID_REMOVEFILES = wx.NewId()
        self.removefile = wx.Button(self, self.ID_REMOVEFILES,
                                    tr("Remove Files"))
        box1.Add(self.removefile, 0, wx.ALL, 2)

        self.ID_CLEAR = wx.NewId()
        self.clear = wx.Button(self, self.ID_CLEAR, tr("Clear Results"))
        box1.Add(self.clear, 0, wx.ALL, 2)

        self.chk_all = wx.CheckBox(self, -1, tr("Select All"))
        box1.Add(self.chk_all, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.chk_select = wx.CheckBox(self, -1, tr("Select"))
        box1.Add(self.chk_select, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.chk_remainsufix = wx.CheckBox(self, -1,
                                           tr('Skip filename suffix'))
        self.chk_remainsufix.SetValue(True)
        box1.Add(self.chk_remainsufix, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        box1.AddStretchSpacer()

        self.ID_APPLY = wx.NewId()
        self.apply = wx.Button(self, self.ID_APPLY, tr("Apply"))
        box1.Add(self.apply, 0, wx.ALL | wx.ALIGN_RIGHT, 2)

        sizer.Add(box1, 0, wx.EXPAND)

        box2 = wx.BoxSizer(wx.HORIZONTAL)
        box2.Add(wx.StaticText(self, -1,
                               tr("Template") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.text = wx.TextCtrl(self, -1, "", size=(150, -1))
        box2.Add(self.text, 1, wx.ALL | wx.EXPAND, 2)

        box2.Add(wx.StaticText(self, -1,
                               tr("Start Num") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.startnum = wx.SpinCtrl(self,
                                    -1,
                                    "1",
                                    size=(40, -1),
                                    min=1,
                                    max=100,
                                    initial=1)
        box2.Add(self.startnum, 0, wx.ALL, 2)

        self.ID_CREATE = wx.NewId()
        self.create = wx.Button(self, self.ID_CREATE, tr("Create"))
        box2.Add(self.create, 0, wx.ALL, 2)

        sizer.Add(box2, 0, wx.EXPAND)

        box3 = wx.BoxSizer(wx.HORIZONTAL)
        box3.Add(wx.StaticText(self, -1,
                               tr("Current Result") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.result = wx.TextCtrl(self, -1, "", size=(150, -1))
        box3.Add(self.result, 1, wx.ALL | wx.EXPAND, 2)

        self.ID_UPDATE = wx.NewId()
        self.update = wx.Button(self, self.ID_UPDATE, tr("Update"))
        box3.Add(self.update, 0, wx.ALL, 2)

        sizer.Add(box3, 0, wx.EXPAND)

        box4 = wx.StaticBoxSizer(wx.StaticBox(self, -1, tr("Group Mode")),
                                 wx.HORIZONTAL)
        box4.Add(wx.StaticText(self, -1,
                               tr("Find") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.find = wx.TextCtrl(self, -1, "", size=(150, -1))
        box4.Add(self.find, 1, wx.ALL | wx.EXPAND, 2)

        box4.Add(wx.StaticText(self, -1,
                               tr("Replace") + ':'), 0,
                 wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)
        self.replace_text = wx.TextCtrl(self, -1, "", size=(150, -1))
        box4.Add(self.replace_text, 1, wx.ALL | wx.EXPAND, 2)

        self.chk_regular = wx.CheckBox(self, -1, tr('Regular Mode'))
        self.chk_regular.SetValue(False)
        box4.Add(self.chk_regular, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.chk_cursor = wx.CheckBox(self, -1, tr('Start from cursor'))
        self.chk_cursor.SetValue(False)
        self.chk_cursor.SetToolTip(
            wx.ToolTip(
                tr('If you set this, the process will begin from \nthe cursor position of "Current Result" field'
                   )))
        box4.Add(self.chk_cursor, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2)

        self.ID_DELETE = wx.NewId()
        self.delete = wx.Button(self, self.ID_DELETE, tr("Delete"))
        box4.Add(self.delete, 0, wx.ALL, 2)

        self.ID_REPLACE = wx.NewId()
        self.replace = wx.Button(self, self.ID_REPLACE, tr("Replace"))
        box4.Add(self.replace, 0, wx.ALL, 2)

        self.ID_INSERT = wx.NewId()
        self.insert = wx.Button(self, self.ID_INSERT, tr("Insert"))
        box4.Add(self.insert, 0, wx.ALL, 2)

        sizer.Add(box4, 0, wx.EXPAND | wx.ALL, 2)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)

        #bind event
        wx.EVT_BUTTON(self.addfile, self.ID_ADDFILES, self.OnAddFiles)
        wx.EVT_BUTTON(self.removefile, self.ID_REMOVEFILES, self.OnRemoveFiles)
        wx.EVT_BUTTON(self.clear, self.ID_CLEAR, self.OnClear)
        wx.EVT_BUTTON(self.create, self.ID_CREATE, self.OnCreate)
        wx.EVT_BUTTON(self.apply, self.ID_APPLY, self.OnApply)
        wx.EVT_BUTTON(self.update, self.ID_UPDATE, self.OnUpdate)
        wx.EVT_BUTTON(self.delete, self.ID_DELETE, self.OnDelete)
        wx.EVT_BUTTON(self.insert, self.ID_INSERT, self.OnInsert)
        wx.EVT_BUTTON(self.replace, self.ID_REPLACE, self.OnReplace)
        wx.EVT_CHECKBOX(self.chk_all, self.chk_all.GetId(), self.OnAll)
        wx.EVT_CHECKBOX(self.chk_select, self.chk_select.GetId(),
                        self.OnSelect)
        wx.EVT_LIST_ITEM_ACTIVATED(self.filenames, self.filenames.GetId(),
                                   self.OnEnterItem)
        wx.EVT_LIST_ITEM_SELECTED(self.filenames, self.filenames.GetId(),
                                  self.OnSelectItem)
        wx.EVT_UPDATE_UI(self.removefile, self.ID_REMOVEFILES, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.chk_select, self.chk_select.GetId(),
                         self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.update, self.ID_UPDATE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.result, self.result.GetId(), self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.find, self.find.GetId(), self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.replace_text, self.replace_text.GetId(),
                         self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.delete, self.ID_DELETE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.replace, self.ID_REPLACE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.insert, self.ID_INSERT, self.OnUpdateUI)