Exemple #1
0
        def __init__(self, parent):
            wx.Frame.__init__(self,
                              parent,
                              id=wx.ID_ANY,
                              title=wx.EmptyString,
                              pos=wx.DefaultPosition,
                              size=wx.Size(500, 300),
                              style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

            self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

            bSizer1 = wx.BoxSizer(wx.VERTICAL)

            self.m_staticText1 = wx.StaticText(self, wx.ID_ANY,
                                               u"Select CSV File",
                                               wx.DefaultPosition,
                                               wx.DefaultSize, 0)
            self.m_staticText1.Wrap(-1)
            bSizer1.Add(self.m_staticText1, 0, wx.ALL, 5)

            self.m_filePicker1 = wx.FilePickerCtrl(self, wx.ID_ANY,
                                                   wx.EmptyString,
                                                   u"Select a file", u"*.csv",
                                                   wx.DefaultPosition,
                                                   wx.Size(500, -1),
                                                   wx.FLP_DEFAULT_STYLE)
            bSizer1.Add(self.m_filePicker1, 0, wx.ALL, 5)

            self.m_button1 = wx.Button(self, wx.ID_ANY, u"Submit",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
            bSizer1.Add(self.m_button1, 0, wx.ALL, 5)

            self.SetSizer(bSizer1)
            self.Layout()

            self.Centre(wx.BOTH)

            # Connect Events
            self.m_button1.Bind(wx.EVT_BUTTON, self.submit)
Exemple #2
0
 def __init_upgrade_sizer(self):
     sizer = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, u"升级"),
                               wx.VERTICAL)
     upgrade_sizer = wx.BoxSizer(wx.HORIZONTAL)
     self.upgarde_gauge = wx.Gauge(self, wx.ID_ANY, 1000,
                                   wx.DefaultPosition, wx.DefaultSize,
                                   wx.GA_HORIZONTAL)
     self.upgarde_gauge.SetValue(0)
     self.upgrade_button = wx.Button(self, wx.ID_ANY, u"升级",
                                     wx.DefaultPosition, wx.DefaultSize, 0)
     self.upgrade_button.Bind(wx.EVT_BUTTON, self.on_upgrade)
     upgrade_sizer.Add(self.upgarde_gauge, 1,
                       wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)
     upgrade_sizer.Add(self.upgrade_button, 0,
                       wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
     self.fpc = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                  u"选择升级文件", u"*.bin", wx.DefaultPosition,
                                  wx.DefaultSize,
                                  wx.FLP_DEFAULT_STYLE | wx.FLP_SMALL)
     sizer.Add(self.fpc, 0, wx.EXPAND | wx.ALL, 0)
     sizer.Add(upgrade_sizer, 0, wx.EXPAND | wx.ALL, 0)
     return sizer
Exemple #3
0
    def __init__(self, *args, **kwds):
        """
        Objetos utilizados en la GUI
        """

        # begin wxGlade: UISendFiles.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.mutex = Semaphore(1)

        self.SetSize((400, 300))
        self.archivo_in = wx.FilePickerCtrl(self, wx.ID_ANY, "Archivo Entrada")
        self.dir_out = wx.DirPickerCtrl(self, wx.ID_ANY, "button_1")
        #self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.send = wx.Button(self, wx.ID_ANY, "Iniciar")
        self.send.Bind(wx.EVT_BUTTON, self.get_path)
        self.num_split = wx.SpinCtrlDouble(self, wx.ID_ANY, '4')

        self.status = wx.StaticText(self, wx.ID_ANY, "Status")

        self.__set_properties()
        self.__do_layout()
    def __init__(self, parent: wx.Window, canvas: "EditCanvas", world: "World",
                 options_path: str):
        SimpleOperationPanel.__init__(self, parent, canvas, world,
                                      options_path)

        options = self._load_options({})

        self._file_picker = wx.FilePickerCtrl(
            self,
            path=options.get('path', ''),
            wildcard="mcstructure file (*.mcstructure)|*.mcstructure",
            style=wx.FLP_USE_TEXTCTRL | wx.FLP_SAVE | wx.FLP_OVERWRITE_PROMPT)
        self._sizer.Add(self._file_picker, 0, wx.ALL | wx.CENTER, 5)
        self._version_define = VersionSelect(self,
                                             world.translation_manager,
                                             options.get("platform", None)
                                             or world.world_wrapper.platform,
                                             allowed_platforms=("bedrock", ),
                                             allow_numerical=False)
        self._sizer.Add(self._version_define, 0, wx.CENTRE, 5)
        self._add_run_button("Export")
        self.Layout()
Exemple #5
0
    def __init__(self, parent, image):
        wx.Dialog.__init__(self, parent, title='Deconvolution')
        nChans = image.data.shape[3]

        sizer1 = wx.BoxSizer(wx.VERTICAL)
        
        sizer2 = wx.GridSizer(nChans, 2, 5, 5)
        
        sizer2.Add(wx.StaticText(self, -1, 'Channel:'))
        sizer2.Add(wx.StaticText(self, -1, 'Shiftmap:'))
        
        self.filectrls = {}
        
        for chan in range(nChans):
            sizer2.Add(wx.StaticText(self, -1, image.names[chan]), 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
            fp = wx.FilePickerCtrl(self, -1, wildcard='*.sm', style=wx.FLP_OPEN|wx.FLP_FILE_MUST_EXIST|wx.FLP_USE_TEXTCTRL)
            sizer2.Add(fp, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
            self.filectrls[chan] = fp
            
        sizer1.Add(sizer2, 1, wx.ALL|wx.EXPAND, 5)
            
        btSizer = wx.StdDialogButtonSizer()

        self.bOK = wx.Button(self, wx.ID_OK)
        self.bOK.SetDefault()

        btSizer.AddButton(self.bOK)

        btn = wx.Button(self, wx.ID_CANCEL)

        btSizer.AddButton(btn)

        btSizer.Realize()

        sizer1.Add(btSizer, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5)

        self.SetSizer(sizer1)
        sizer1.Fit(self)
Exemple #6
0
    def InitUI(self):

        pnl = wx.Panel(self, size=(500, 550))
        vbox = wx.BoxSizer(wx.VERTICAL)

        wx.StaticText(pnl, -1, 'Title', (20, 20))
        wx.StaticText(pnl, -1, 'Type', (20, 60))
        wx.StaticText(pnl, -1, 'Picture', (20, 100))
        wx.StaticText(pnl, -1, 'Ingredients', (20, 140))

        self.title = wx.TextCtrl(pnl, -1, '', (130, 15), (350, 36))
        self.type = wx.ComboBox(pnl,
                                -1,
                                '', (130, 55),
                                size=(350, 36),
                                choices=self.types,
                                style=wx.ALIGN_CENTER)

        self.file = wx.FilePickerCtrl(pnl,
                                      wx.ID_ANY,
                                      pos=(130, 95),
                                      size=(350, 36))
        self.ingredients = wx.TextCtrl(pnl,
                                       -1,
                                       '', (130, 135), (350, 72),
                                       style=wx.TE_MULTILINE)
        self.description = wx.TextCtrl(pnl,
                                       -1,
                                       'Description...', (20, 212), (460, 264),
                                       style=wx.TE_MULTILINE)

        wx.Button(pnl, 1, 'Create', (240, 500), (120, -1))
        wx.Button(pnl, 2, 'Cancel', (360, 500), (120, -1))

        self.Bind(wx.EVT_BUTTON, self.OnCreate, id=1)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, id=2)

        self.SetSizer(vbox)
Exemple #7
0
    def __init__(self, parent, message, path):
        wx.Panel.__init__(self, parent=parent)

        self.FileLabel = wx.StaticText(
            self, label=message,
            style=wx.ALIGN_CENTER)  # Static part of image index display
        #FIXME: We have to jump through these hoops, because wx.FLP_SAVE seems to be set by init, even if the style is specified; so we cannot set wx.FLP_FILE_MUST_EXIST with it
        self.FileChooser = wx.FilePickerCtrl(self,
                                             message=message,
                                             path=path,
                                             style=wx.FLP_USE_TEXTCTRL)
        self.FileChooser.SetWindowStyleFlag(wx.ALIGN_CENTER
                                            | wx.FLP_USE_TEXTCTRL | wx.FLP_OPEN
                                            | wx.FLP_FILE_MUST_EXIST)
        self.FileChooser.Refresh()
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        self.sizer.Add(self.FileLabel, 0, wx.ALIGN_CENTER | wx.SHAPED)
        self.sizer.Add(self.FileChooser, 0, wx.ALIGN_CENTER | wx.EXPAND)
        self.SetSizer(self.sizer)

        self.FileChooser.SetInitialDirectory(os.path.dirname(path))
        self.FileChooser.SetPath(path)
Exemple #8
0
    def create_left_sizer(self):
        sizer = wx.BoxSizer(wx.VERTICAL)

        self.file_picker = wx.FilePickerCtrl(self, 
            message="Bitte Log-Export auswählen", 
            wildcard="*.json",
            style=wx.FLP_OPEN|wx.FLP_FILE_MUST_EXIST)
            #style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL)
        sizer.Add(self.file_picker, 0, wx.ALL , 5)
        self.file_picker.Bind(wx.EVT_FILEPICKER_CHANGED, self.read_file)
        
        pFile = self.file_picker.GetPickerCtrl()
        pFile.SetLabel("Log-Datei auswählen")
        #pTextFile = self.file_picker.GetTextCtrl()
        #pTextFile.SetStyle(self, wx.TE_READONLY)

        # TODO add search (SearchCtrl)

        self.allTags_list_ctrl = OrderListControl(self,  size=(351, 450))
        self.allTags_list_ctrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.update_details, self.allTags_list_ctrl)
        sizer.Add(self.allTags_list_ctrl, 1, wx.ALL, 5) 

        return sizer
def show_ui(parent, world: "World", options: dict) -> dict:
    dialog = SimpleDialog(parent, 'Export Construction')
    file_picker = wx.FilePickerCtrl(
        dialog,
        path=options.get('path', ''),
        wildcard="Construction file (*.construction)|*.construction",
        style=wx.FLP_USE_TEXTCTRL | wx.FLP_SAVE | wx.FLP_OVERWRITE_PROMPT)
    dialog.sizer.Add(file_picker, 0, wx.ALL, 5)
    version_define = VersionSelect(dialog,
                                   world.translation_manager,
                                   options.get("platform", None)
                                   or world.world_wrapper.platform,
                                   allow_universal=False)
    dialog.sizer.Add(version_define, 0)
    dialog.Fit()

    if dialog.ShowModal() == wx.ID_OK:
        options = {
            "path": file_picker.GetPath(),
            "platform": version_define.platform,
            "version": version_define.version
        }
    return options
Exemple #10
0
    def __init__(self, *args, **kwargs):
        super(Regframe, self).__init__(*args, **kwargs)
        self.SetSize((500, 200))
        self.SetPosition((500, 400))
        panel = wx.Panel(self)
        self.filepicker = wx.FilePickerCtrl(panel,
                                            pos=(30, 30),
                                            size=(100, 25))
        self.savepicker = wx.TextCtrl(panel)
        sb = wx.StaticBox(panel, label='文件路径')
        sbs = wx.StaticBoxSizer(sb, wx.VERTICAL)
        sbs.Add(wx.StaticText(panel, -1, '请选择文件:'))
        sbs.Add(self.filepicker)
        sbs.Add(wx.StaticText(panel, -1, 'Save As:'))
        sbs.Add(self.savepicker)

        plotbutton = wx.Button(panel, label='画图')
        plotbutton.Bind(wx.EVT_BUTTON, self.plot)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        hsizer.Add(sbs)
        hsizer.Add(plotbutton)
        panel.SetSizer(hsizer)
Exemple #11
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           id=wx.ID_ANY,
                           title=wx.EmptyString,
                           pos=wx.DefaultPosition,
                           size=wx.Size(577, 90),
                           style=wx.DEFAULT_DIALOG_STYLE)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        bSizers = wx.BoxSizer(wx.VERTICAL)

        self.filePicker = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                            u"Select a file", u"*.*",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            wx.FLP_DEFAULT_STYLE)
        bSizers.Add(self.filePicker, 1, wx.ALL | wx.EXPAND, 5)

        m_OkCencel_sdbSizer = wx.StdDialogButtonSizer()
        self.m_OkCencel_sdbSizerOK = wx.Button(self, wx.ID_OK)
        m_OkCencel_sdbSizer.AddButton(self.m_OkCencel_sdbSizerOK)
        self.m_OkCencel_sdbSizerCancel = wx.Button(self, wx.ID_CANCEL)
        m_OkCencel_sdbSizer.AddButton(self.m_OkCencel_sdbSizerCancel)
        m_OkCencel_sdbSizer.Realize()

        bSizers.Add(m_OkCencel_sdbSizer, 1, wx.EXPAND, 5)

        self.SetSizer(bSizers)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.filePicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.onFileChange)
        self.m_OkCencel_sdbSizerCancel.Bind(wx.EVT_BUTTON, self.onCANCEL_Click)
        self.m_OkCencel_sdbSizerOK.Bind(wx.EVT_BUTTON, self.onOK_Click)
Exemple #12
0
    def __init__(
        self,
        parent: wx.Window,
        canvas: "EditCanvas",
        world: "BaseLevel",
        options_path: str,
    ):
        SimpleOperationPanel.__init__(self, parent, canvas, world,
                                      options_path)

        options = self._load_options({})

        self._file_picker = wx.FilePickerCtrl(
            self,
            path=options.get("path", ""),
            wildcard="Schematic file (*.schematic)|*.schematic",
            style=wx.FLP_USE_TEXTCTRL | wx.FLP_SAVE,
        )
        self._sizer.Add(self._file_picker, 0, wx.ALL | wx.CENTER, 5)
        self._platform_define = PlatformSelect(
            self,
            world.translation_manager,
            options.get("platform", None) or world.level_wrapper.platform,
            allow_universal=False,
        )
        self._sizer.Add(self._platform_define, 0, wx.CENTRE, 5)
        self._sizer.Add(
            wx.StaticText(self,
                          label=WarningMsg,
                          style=wx.ALIGN_CENTRE_HORIZONTAL),
            0,
            wx.ALL | wx.CENTER,
            5,
        )
        self._add_run_button("Export")
        self.Layout()
Exemple #13
0
    def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)

        # put some text in it
        info = wx.StaticText(
            self,
            label="This script allows you to run a script from a file.",
            pos=(25, 15))
        kiesFolder = wx.StaticText(self,
                                   label="Kies python script",
                                   pos=(25, 40))
        dirSelectorPromptStr = "Kies folder"
        DIRP_DEFAULT_STYLE = wx.DIRP_DIR_MUST_EXIST
        DirPickerCtrlNameStr = "test Picker"
        #self.chosenfolder = wx.DirPickerCtrl(self, id=1, path="", message=dirSelectorPromptStr, pos=(25, 70), style=DIRP_DEFAULT_STYLE, name=DirPickerCtrlNameStr)
        self.chosenfile = wx.FilePickerCtrl(self,
                                            id=1,
                                            path="",
                                            message="Select a python file",
                                            pos=(25, 70),
                                            size=(500, -1))
        self.button = wx.Button(self, label="Run script", pos=(25, 170))
        self.Bind(wx.EVT_BUTTON, self.onButton)
 def Add_Filepicker(self):
     self.filepicker_index += 1
     bSizer = wx.BoxSizer(wx.HORIZONTAL)
     Text = wx.StaticText(self, wx.ID_ANY,
                          u"Source file " + str(self.filepicker_index + 1),
                          wx.DefaultPosition, wx.DefaultSize, 0)
     Text.Wrap(-1)
     bSizer.Add(Text, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     FilePicker = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                    u"Select a file", u"*.*",
                                    wx.DefaultPosition, wx.DefaultSize,
                                    wx.FLP_DEFAULT_STYLE)
     FilePicker.SetInitialDirectory(self.compilation_dir)
     bSizer.Add(FilePicker, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.caution = wx.StaticText(self, wx.ID_ANY, u"", wx.DefaultPosition,
                                  wx.DefaultSize, 0)
     self.caution.Wrap(-1)
     bSizer.Add(self.caution, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.bSizer_SBFLTargetChoose.Insert(
         self.bSizer_SBFLTargetChoose.GetItemCount() - 2, bSizer, 1,
         wx.EXPAND, 5)
     self.Layout()
     self.bSizer_SBFLTargetChoose.Fit(self)
     self.filepicker_list.append(FilePicker)
Exemple #15
0
    def file_picker(self, label, pick_dir=False, handler=None, optional=False, initial_on=False, pack=True, **kwargs):
        """
        Add a file picker to the tab
        """
        if not handler:
            handler = self.state_changed
        if pick_dir:
            picker = wx.DirPickerCtrl(self, style=wx.DIRP_USE_TEXTCTRL)
            picker.Bind(wx.EVT_DIRPICKER_CHANGED, handler)
        else:
            picker = wx.FilePickerCtrl(self)
            picker.Bind(wx.EVT_FILEPICKER_CHANGED, handler)
        picker.span = 2
        if optional:
            checkbox = wx.CheckBox(self, label=label)
            checkbox.SetValue(initial_on)
            checkbox.Bind(wx.EVT_CHECKBOX, self._checkbox_toggle_cb(checkbox, picker))
            picker.checkbox = checkbox
            if pack:
                self.pack("", checkbox, picker, enable=initial_on, **kwargs)
        elif pack:
            self.pack(label, picker, **kwargs)

        return picker
Exemple #16
0
    def __init__(self, parent, lbl, btn1, btn2):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.Size(563, 228),
                          style=wx.TAB_TRAVERSAL)

        self.SetLayoutDirection(2)
        self.sndget = sg.GetData(u'', u'')

        VS1 = wx.BoxSizer(wx.VERTICAL)

        HSA1 = wx.BoxSizer(wx.HORIZONTAL)

        VS2 = wx.BoxSizer(wx.VERTICAL)

        HSC3 = wx.BoxSizer(wx.HORIZONTAL)

        self.lbl3 = wx.StaticText(self, wx.ID_ANY, lbl[0], wx.DefaultPosition,
                                  wx.Size(50, -1), 0)
        self.lbl3.Wrap(-1)
        HSC3.Add(self.lbl3, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.fild3 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                 wx.DefaultPosition, wx.Size(70, -1), 0)
        HSC3.Add(self.fild3, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.sbtn1 = wx.Button(self, wx.ID_ANY, u"...", wx.DefaultPosition,
                               wx.DefaultSize, wx.BU_EXACTFIT)
        HSC3.Add(self.sbtn1, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.lbl35 = wx.StaticText(self, wx.ID_ANY, lbl[1], wx.DefaultPosition,
                                   wx.Size(-1, -1), wx.ALIGN_RIGHT)
        self.lbl35.Wrap(-1)
        HSC3.Add(self.lbl35, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.filePic1 = wx.FilePickerCtrl(
            self, wx.ID_ANY, wx.EmptyString, u"فایل عکس کارمند", u"*.jpg",
            wx.DefaultPosition, wx.DefaultSize,
            wx.FLP_DEFAULT_STYLE | wx.FLP_OPEN | wx.FLP_SMALL)
        HSC3.Add(self.filePic1, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        VS2.Add(HSC3, 1, wx.EXPAND, 5)

        HSC1 = wx.BoxSizer(wx.HORIZONTAL)

        self.lbl1 = wx.StaticText(self, wx.ID_ANY, lbl[2], wx.DefaultPosition,
                                  wx.Size(50, -1), wx.ALIGN_RIGHT)
        self.lbl1.Wrap(-1)
        HSC1.Add(self.lbl1, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.fild1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                 wx.DefaultPosition, wx.DefaultSize, 0)
        HSC1.Add(self.fild1, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.lbl2 = wx.StaticText(self, wx.ID_ANY, lbl[3], wx.DefaultPosition,
                                  wx.Size(70, -1), wx.ALIGN_RIGHT)
        self.lbl2.Wrap(-1)
        HSC1.Add(self.lbl2, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.fild2 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                 wx.DefaultPosition, wx.DefaultSize, 0)
        HSC1.Add(self.fild2, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        VS2.Add(HSC1, 1, wx.EXPAND, 5)

        HSC2 = wx.BoxSizer(wx.HORIZONTAL)

        self.lbl4 = wx.StaticText(self, wx.ID_ANY, lbl[4], wx.DefaultPosition,
                                  wx.Size(50, -1), wx.ALIGN_RIGHT)
        self.lbl4.Wrap(-1)
        HSC2.Add(self.lbl4, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        List1Choices = self.grouplist()
        self.List1 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition,
                               wx.Size(-1, -1), List1Choices, 0)
        self.List1.SetSelection(0)
        HSC2.Add(self.List1, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.sbtn2 = wx.Button(self, wx.ID_ANY, u"...", wx.DefaultPosition,
                               wx.DefaultSize, wx.BU_EXACTFIT)
        HSC2.Add(self.sbtn2, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.lbl5 = wx.StaticText(self, wx.ID_ANY, lbl[5], wx.DefaultPosition,
                                  wx.Size(60, -1), wx.ALIGN_RIGHT)
        self.lbl5.Wrap(-1)
        HSC2.Add(self.lbl5, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        List2Choices = []
        self.List2 = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition,
                               wx.Size(-1, -1), List2Choices, 0)
        self.List2.SetSelection(0)
        HSC2.Add(self.List2, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        VS2.Add(HSC2, 1, wx.EXPAND, 5)

        HSA1.Add(VS2, 1, wx.EXPAND, 5)

        HSB = wx.BoxSizer(wx.HORIZONTAL)

        HSB.AddSpacer((0, 0), 1, wx.EXPAND, 5)

        self.picmploy = wx.StaticBitmap(self, wx.ID_ANY,
                                        wx.NullBitmap, wx.DefaultPosition,
                                        wx.Size(20, 20), wx.DOUBLE_BORDER)
        HSB.Add(self.picmploy, 0, wx.SHAPED | wx.EXPAND, 5)

        HSA1.Add(HSB, 1, wx.EXPAND, 5)

        VS1.Add(HSA1, 1, wx.EXPAND, 5)

        HSA2 = wx.BoxSizer(wx.HORIZONTAL)

        self.lbl6 = wx.StaticText(self, wx.ID_ANY, lbl[6], wx.DefaultPosition,
                                  wx.Size(50, -1), wx.ALIGN_RIGHT)
        self.lbl6.Wrap(-1)
        HSA2.Add(self.lbl6, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.fild4 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString,
                                 wx.DefaultPosition, wx.Size(-1, -1), 0)
        HSA2.Add(self.fild4, 0, wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM | wx.LEFT,
                 5)

        self.sbtn3 = wx.Button(self, wx.ID_ANY, u"...", wx.DefaultPosition,
                               wx.DefaultSize, wx.BU_EXACTFIT)
        HSA2.Add(self.sbtn3, 0, wx.ALL, 5)

        self.lbl7 = wx.StaticText(self, wx.ID_ANY, lbl[7], wx.DefaultPosition,
                                  wx.DefaultSize, 0)
        self.lbl7.Wrap(-1)
        HSA2.Add(self.lbl7, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.sbtn4 = wx.Button(self, wx.ID_ANY, u"...", wx.DefaultPosition,
                               wx.DefaultSize, wx.BU_EXACTFIT)
        HSA2.Add(self.sbtn4, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.lbl8 = wx.StaticText(self, wx.ID_ANY, lbl[8], wx.DefaultPosition,
                                  wx.DefaultSize, 0)
        self.lbl8.Wrap(-1)
        HSA2.Add(self.lbl8, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.sbtn5 = wx.Button(self, wx.ID_ANY, u"...", wx.DefaultPosition,
                               wx.DefaultSize, wx.BU_EXACTFIT)
        HSA2.Add(self.sbtn5, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        VS1.Add(HSA2, 0, wx.EXPAND, 5)

        HSA3 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_checkBox1 = wx.CheckBox(self, wx.ID_ANY, u"ثبت در لیست حقوق",
                                       wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_checkBox1.Enable(False)
        HSA3.Add(self.m_checkBox1, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        HSA3.AddSpacer((0, 0), 1, wx.EXPAND, 5)

        self.btn3 = wx.Button(self, wx.ID_ANY, btn1, wx.DefaultPosition,
                              wx.DefaultSize, 0)
        HSA3.Add(self.btn3, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        self.btn1 = wx.Button(self, wx.ID_ANY, btn2, wx.DefaultPosition,
                              wx.DefaultSize, 0)
        HSA3.Add(self.btn1, 0, wx.ALIGN_CENTER | wx.ALL, 5)

        VS1.Add(HSA3, 0, wx.EXPAND, 5)

        self.SetSizer(VS1)
        self.Layout()

        # Connect Events
        self.sbtn1.Bind(wx.EVT_BUTTON, self.search)
        self.filePic1.Bind(wx.EVT_FILEPICKER_CHANGED, self.picfile)
        self.sbtn2.Bind(wx.EVT_BUTTON, self.Ongroup)
        self.sbtn3.Bind(wx.EVT_BUTTON, self.iplist)
        self.sbtn4.Bind(wx.EVT_BUTTON, self.finger)
        self.sbtn5.Bind(wx.EVT_BUTTON, self.othersp)
        self.btn3.Bind(wx.EVT_BUTTON, self.cancl)
        self.btn1.Bind(wx.EVT_BUTTON, self.entry)
Exemple #17
0
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"M5-FontCreator", pos = wx.DefaultPosition, size = wx.Size( 466,302 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )

		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
		self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) )

		bSizer1 = wx.BoxSizer( wx.VERTICAL )

		fgSizer1 = wx.FlexGridSizer( 0, 3, 0, 0 )
		fgSizer1.SetFlexibleDirection( wx.BOTH )
		fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

		bSizer3 = wx.BoxSizer( wx.VERTICAL )

		self.listctrl_fontinfo = wx.ListCtrl( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,260 ), wx.LC_HRULES|wx.LC_REPORT|wx.LC_SORT_ASCENDING )
		bSizer3.Add( self.listctrl_fontinfo, 0, wx.ALL|wx.EXPAND, 5 )


		fgSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )

		bSizer5 = wx.BoxSizer( wx.VERTICAL )

		bSizer9 = wx.BoxSizer( wx.HORIZONTAL )

		self.Button_Save = wx.Button( self, wx.ID_ANY, u"Save", wx.DefaultPosition, wx.Size( 50,-1 ), 0 )
		bSizer9.Add( self.Button_Save, 0, wx.ALL, 5 )

		self.FilePicker_Load = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a block file", u"*.json", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST )
		bSizer9.Add( self.FilePicker_Load, 0, wx.ALL, 5 )


		bSizer5.Add( bSizer9, 0, 0, 5 )

		self.button_add = wx.Button( self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer5.Add( self.button_add, 0, wx.ALL|wx.EXPAND, 5 )

		self.button_delete = wx.Button( self, wx.ID_ANY, u"Delete", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer5.Add( self.button_delete, 0, wx.ALL|wx.EXPAND, 5 )

		fgSizer51 = wx.FlexGridSizer( 0, 2, 0, 0 )
		fgSizer51.SetFlexibleDirection( wx.BOTH )
		fgSizer51.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )

		self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, u"Font Spacing", wx.DefaultPosition, wx.Size( -1,-1 ), 0 )
		self.m_staticText21.Wrap( -1 )

		fgSizer51.Add( self.m_staticText21, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )

		self.InputBox_Spacing = wx.TextCtrl( self, wx.ID_ANY, u"1", wx.DefaultPosition, wx.Size( 25,-1 ), 0 )
		self.InputBox_Spacing.SetMaxLength( 1 )
		self.InputBox_Spacing.SetMinSize( wx.Size( 25,-1 ) )
		self.InputBox_Spacing.SetMaxSize( wx.Size( 25,-1 ) )

		fgSizer51.Add( self.InputBox_Spacing, 1, wx.ALL|wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5 )

		self.m_staticText211 = wx.StaticText( self, wx.ID_ANY, u"Font Size(px)", wx.DefaultPosition, wx.Size( -1,-1 ), 0 )
		self.m_staticText211.Wrap( -1 )

		fgSizer51.Add( self.m_staticText211, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )

		self.InputBox_Size = wx.TextCtrl( self, wx.ID_ANY, u"24", wx.DefaultPosition, wx.Size( 25,-1 ), 0 )
		self.InputBox_Size.SetMaxLength( 2 )
		self.InputBox_Size.SetMinSize( wx.Size( 25,-1 ) )
		self.InputBox_Size.SetMaxSize( wx.Size( 25,-1 ) )

		fgSizer51.Add( self.InputBox_Size, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )


		bSizer5.Add( fgSizer51, 1, wx.EXPAND, 5 )

		self.InputBox_FontName = wx.TextCtrl( self, wx.ID_ANY, u"Enter a font name", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.InputBox_FontName.SetMaxLength( 20 )
		bSizer5.Add( self.InputBox_FontName, 0, wx.ALL, 5 )

		self.button_gen = wx.Button( self, wx.ID_ANY, u"Gerenate", wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer5.Add( self.button_gen, 0, wx.ALL|wx.EXPAND, 5 )


		fgSizer1.Add( bSizer5, 1, wx.EXPAND, 5 )


		bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )


		self.SetSizer( bSizer1 )
		self.Layout()

		self.Centre( wx.BOTH )

		# Connect Events
		self.listctrl_fontinfo.Bind( wx.EVT_LIST_ITEM_SELECTED, self.OnListItemSelect_Cb )
		self.Button_Save.Bind( wx.EVT_BUTTON, self.Button_Save_CB )
		self.FilePicker_Load.Bind( wx.EVT_FILEPICKER_CHANGED, self.FilePicker_Load_CB )
		self.button_add.Bind( wx.EVT_BUTTON, self.ButtonAdd_Cb )
		self.button_delete.Bind( wx.EVT_BUTTON, self.ButtonDelete_Cb )
		self.button_gen.Bind( wx.EVT_BUTTON, self.Gerenate_Cb )
Exemple #18
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           id=wx.ID_ANY,
                           title=u"Configuration",
                           pos=wx.DefaultPosition,
                           size=wx.Size(460, 170),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        bSizer9 = wx.BoxSizer(wx.VERTICAL)

        self.m_panel3 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition,
                                 wx.DefaultSize, wx.TAB_TRAVERSAL)
        bSizer10 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText11 = wx.StaticText(self.m_panel3, wx.ID_ANY,
                                            u"Path to Nsis Exe",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText11.Wrap(-1)
        self.m_staticText11.SetFont(wx.Font(8, 74, 90, 92, False, "Tahoma"))

        bSizer10.Add(self.m_staticText11, 0, wx.ALL, 5)

        self.m_staticText12 = wx.StaticText(
            self.m_panel3, wx.ID_ANY,
            u"In order to configurate py2Nsis you have to especify the path to your makensisw.exe file",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText12.Wrap(-1)
        bSizer10.Add(self.m_staticText12, 0, wx.ALL, 5)

        self.dpNsisPath = wx.FilePickerCtrl(
            self.m_panel3, wx.ID_ANY,
            u"C:\\Archivos de programa\\NSIS\\makensisw.exe", u"Select a file",
            u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE)
        bSizer10.Add(self.dpNsisPath, 0, wx.ALL | wx.EXPAND, 5)

        self.m_staticText121 = wx.StaticText(
            self.m_panel3, wx.ID_ANY,
            u"Atention: (Ensure you have Python in your environment variables)",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText121.Wrap(-1)
        bSizer10.Add(self.m_staticText121, 0, wx.ALL, 5)

        bSizer11 = wx.BoxSizer(wx.HORIZONTAL)

        self.btOk = wx.Button(self.m_panel3, wx.ID_ANY, u"Ok",
                              wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer11.Add(self.btOk, 0, wx.ALL, 5)

        self.btCancel = wx.Button(self.m_panel3, wx.ID_ANY, u"Cancel",
                                  wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer11.Add(self.btCancel, 0, wx.ALL, 5)

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

        self.m_panel3.SetSizer(bSizer10)
        self.m_panel3.Layout()
        bSizer10.Fit(self.m_panel3)
        bSizer9.Add(self.m_panel3, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(bSizer9)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.btOk.Bind(wx.EVT_BUTTON, self.btOk_click)
        self.btCancel.Bind(wx.EVT_BUTTON, self.btCancel_click)
Exemple #19
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent, -1)

        box = wx.BoxSizer(wx.VERTICAL)
        title = wx.StaticText(self, -1, "Picker Controls")
        title.SetFont(wx.FFont(24, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD))
        title.SetForegroundColour("navy")
        box.Add(title, 0, wx.ALIGN_CENTER|wx.ALL, 5)
        #print(title.GetBestSize(), title.GetMinSize(), title.GetSize())

        box.Add(wx.StaticLine(self), 0, wx.EXPAND)

        fgs = wx.FlexGridSizer(cols=4, hgap=5, vgap=5)
        fgs.AddGrowableCol(3)
        fgs.Add((10,10))  # spacer
        lbl = wx.StaticText(self, -1, "default style")
        lbl.SetFont(wx.FFont(12, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD))
        fgs.Add(lbl)
        fgs.Add((10,10))  # spacer
        lbl = wx.StaticText(self, -1, "with textctrl")
        lbl.SetFont(wx.FFont(12, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD))
        fgs.Add(lbl, 0, wx.ALIGN_CENTER)

        fgs.Add(wx.StaticText(self, -1, "wx.ColourPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL)
        cp1 = wx.ColourPickerCtrl(self)
        fgs.Add(cp1, 0, wx.ALIGN_CENTER)
        fgs.Add((10,10))  # spacer
        cp2 = wx.ColourPickerCtrl(self, style=wx.CLRP_USE_TEXTCTRL)
        cp2.SetTextCtrlProportion(5)
        fgs.Add(cp2, 0, wx.EXPAND)
        fgs.Add(wx.StaticText(self, -1, "        with label:"), 0, wx.ALIGN_CENTER_VERTICAL)
        cp3 = wx.ColourPickerCtrl(self, style=wx.CLRP_SHOW_LABEL)
        fgs.Add(cp3, 0, wx.ALIGN_CENTER)
        fgs.Add((10,10))  # spacer
        fgs.Add((10,10))  # spacer
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnPickColor, cp1)
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnPickColor, cp2)
        self.Bind(wx.EVT_COLOURPICKER_CHANGED, self.OnPickColor, cp3)

        fgs.Add(wx.StaticText(self, -1, "wx.DirPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL)
        dp1 = wx.DirPickerCtrl(self)
        fgs.Add(dp1, 0, wx.ALIGN_CENTER)
        fgs.Add((10,10))  # spacer
        dp2 = wx.DirPickerCtrl(self, style=wx.DIRP_USE_TEXTCTRL)
        dp2.SetTextCtrlProportion(2)
        fgs.Add(dp2, 0, wx.EXPAND)
        self.Bind(wx.EVT_DIRPICKER_CHANGED, self.OnPickFileDir, dp1)
        self.Bind(wx.EVT_DIRPICKER_CHANGED, self.OnPickFileDir, dp2)

        fgs.Add(wx.StaticText(self, -1, "wx.FilePickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL)
        fp1 = wx.FilePickerCtrl(self)
        fgs.Add(fp1, 0, wx.ALIGN_CENTER)
        fgs.Add((10,10))  # spacer
        fp2 = wx.FilePickerCtrl(self, style=wx.FLP_USE_TEXTCTRL)
        fp2.SetTextCtrlProportion(2)
        fgs.Add(fp2, 0, wx.EXPAND)
        self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPickFileDir, fp1)
        self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPickFileDir, fp2)

        fgs.Add(wx.StaticText(self, -1, "wx.FontPickerCtrl:"), 0, wx.ALIGN_CENTER_VERTICAL)
        fnt1 = wx.FontPickerCtrl(self, style=wx.FNTP_FONTDESC_AS_LABEL)
        fgs.Add(fnt1, 0, wx.ALIGN_CENTER)
        fgs.Add((10,10))  # spacer
        fnt2 = wx.FontPickerCtrl(self, style=wx.FNTP_FONTDESC_AS_LABEL|wx.FNTP_USE_TEXTCTRL)
        fnt2.SetTextCtrlProportion(2)
        fgs.Add(fnt2, 0, wx.EXPAND)
        self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnPickFont, fnt1)
        self.Bind(wx.EVT_FONTPICKER_CHANGED, self.OnPickFont, fnt2)


        box.Add(fgs, 1, wx.EXPAND|wx.ALL, 5)
        self.SetSizer(box)
Exemple #20
0
    def Build(self):
        self.wildcard = "HRC Data Settings File (*.Fsd;*.fsd)|*.Fsd;*.fsd"
        self.byts = None
        self.bootwait = False
        self.statusbar = self.CreateStatusBar(1)
        self.statusbar.SetSize((-1, 28))
        self.statusbar.SetStatusStyles([wx.SB_SUNKEN])
        self.SetStatusBar(self.statusbar)

        self.outerp = wx.Panel(self)
        self.mainp = wx.Panel(self.outerp)
        self.wfilel = wx.StaticText(self.mainp, label="File")
        self.readfpicker = wx.FilePickerCtrl(
            self.mainp,
            wildcard=self.wildcard,
            style=wx.FLP_SAVE | wx.FLP_USE_TEXTCTRL | wx.FLP_SMALL)
        self.writefpicker = wx.FilePickerCtrl(
            self.mainp,
            wildcard=self.wildcard,
            style=wx.FLP_OPEN | wx.FLP_FILE_MUST_EXIST | wx.FLP_USE_TEXTCTRL
            | wx.FLP_SMALL)
        self.optsp = wx.Panel(self.mainp)
        self.optsp.SetSizeHints((500, 32))
        self.namel = wx.StaticText(self.optsp, label="Data Name")
        self.name = wx.TextCtrl(self.optsp, size=(200, -1))

        self.gobutton = wx.Button(self.mainp, label="Read")
        self.gobutton.Disable()

        self.optsbox = wx.BoxSizer(wx.HORIZONTAL)
        self.optsbox.Add(self.namel,
                         0,
                         flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL
                         | wx.LEFT,
                         border=10)
        self.optsbox.Add(self.name, 0, flag=wx.LEFT, border=5)
        self.optsp.SetSizer(self.optsbox)

        self.fpickerbox = wx.BoxSizer(wx.HORIZONTAL)
        self.fpickerbox.AddSpacer(5)
        self.fpickerbox.Add(self.readfpicker, 1)
        self.fpickerbox.Add(self.writefpicker, 1)

        self.lastpulse = time.time()
        self.progress = wx.Gauge(self.mainp,
                                 size=(400, -1),
                                 style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
        self.progress.SetRange(100)

        self.modebox = wx.RadioBox(self.mainp,
                                   label="Mode",
                                   choices=["Read", "Write"])

        self.flashpsizer = wx.GridBagSizer()
        self.flashpsizer.Add(self.wfilel,
                             pos=(0, 0),
                             flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL
                             | wx.LEFT,
                             border=10)
        self.flashpsizer.Add(self.fpickerbox,
                             pos=(0, 1),
                             span=(1, 5),
                             flag=wx.EXPAND | wx.RIGHT | wx.BOTTOM,
                             border=10)
        self.flashpsizer.Add(self.optsp, pos=(1, 0), span=(1, 6))
        self.flashpsizer.Add(self.progress,
                             pos=(2, 0),
                             span=(1, 6),
                             flag=wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.EXPAND
                             | wx.TOP,
                             border=20)
        self.flashpsizer.Add(self.modebox,
                             pos=(3, 0),
                             span=(1, 2),
                             flag=wx.ALIGN_LEFT | wx.ALIGN_BOTTOM | wx.LEFT,
                             border=10)
        self.flashpsizer.Add(self.gobutton,
                             pos=(3, 5),
                             flag=wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM | wx.RIGHT,
                             border=10)
        self.flashpsizer.AddGrowableRow(3, 1)
        self.flashpsizer.AddGrowableCol(5, 1)
        self.mainp.SetSizer(self.flashpsizer)

        self.outersizer = wx.BoxSizer(wx.VERTICAL)
        self.outersizer.Add(self.mainp, 1, wx.EXPAND | wx.ALL, border=10)
        self.outerp.SetSizer(self.outersizer)

        self.mainsizer = wx.BoxSizer(wx.VERTICAL)
        self.mainsizer.Add(self.outerp, 1, wx.EXPAND)
        self.SetSizer(self.mainsizer)

        self.readfpicker.Hide()
        self.mainsizer.Fit(self)
        self.Layout()

        self.OnModeChange(None)

        self.name.Bind(wx.EVT_TEXT, self.OnValidateMode)
        self.readfpicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnValidateMode)
        self.writefpicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnValidateMode)
        self.gobutton.Bind(wx.EVT_BUTTON, self.OnGo)
        self.modebox.Bind(wx.EVT_RADIOBOX, self.OnModeChange)
Exemple #21
0
    def __init__(self, parent):

        #GET DATA FROM CONFIG FILE
        # IMPORT SETTING
        # LOAD DATABASE SETTING FROM CONFIG.txt
        config = ConfigParser.ConfigParser()
        config.readfp(open(r'config.txt'))

        self.StreamType = config.get('Stream Camera Configuration', 'Type')
        if self.StreamType == '' or len(self.StreamType) == 0:
            pass
        elif self.StreamType == 'Link':
            self.LinkStream = config.get('Stream Camera Configuration', 'Link')
        elif self.StreamType == 'Image':
            self.ImageStream = config.get('Stream Camera Configuration', 'Image')

        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition,
                          size=wx.Size(730, 665), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INACTIVECAPTION))

        fgSizer2 = wx.FlexGridSizer(4, 1, 0, 0)
        fgSizer2.SetFlexibleDirection(wx.BOTH)
        fgSizer2.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        fgSizer2.SetMinSize(wx.Size(600, -1))
        bSizer2 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer2.SetMinSize(wx.Size(600, -1))
        self.Lbl_Link = wx.StaticText(self, wx.ID_ANY, u"Link", wx.DefaultPosition, wx.DefaultSize, 0)
        self.Lbl_Link.Wrap(-1)
        bSizer2.Add(self.Lbl_Link, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.Txt_Link = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(450, -1), 0)
        bSizer2.Add(self.Txt_Link, 0, wx.ALL | wx.EXPAND, 5)

        self.Cmd_GoLink = wx.Button(self, wx.ID_ANY, u"Go", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer2.Add(self.Cmd_GoLink, 0, wx.ALL, 5)

        self.Cmd_RefreshPg = wx.Button(self, wx.ID_ANY, u"Refresh Page", wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer2.Add(self.Cmd_RefreshPg, 0, wx.ALL, 5)


        fgSizer2.Add(bSizer2, 1, wx.EXPAND, 5)

        bSizer3 = wx.BoxSizer(wx.HORIZONTAL)

        self.Jdl_Img = wx.StaticText(self, wx.ID_ANY, u"Browse Image", wx.Point(3, 3), wx.DefaultSize, 0)
        self.Jdl_Img.Wrap(-1)
        bSizer3.Add(self.Jdl_Img, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.Dir_Img = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition,
                                         wx.DefaultSize, wx.FLP_DEFAULT_STYLE)
        bSizer3.Add(self.Dir_Img, 0, wx.ALL | wx.EXPAND, 5)

        fgSizer2.Add(bSizer3, 1, wx.EXPAND, 5)

        self.MyBrowser2 = wx.html.HtmlWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
                                             wx.html.HW_SCROLLBAR_AUTO)
        self.MyBrowser2.SetMinSize(wx.Size(700, 550))

        fgSizer2.Add(self.MyBrowser2, 0, wx.ALL, 5)

        self.SetSizer(fgSizer2)
        self.Layout()

        self.Centre(wx.BOTH)


        #Constant
        self.start_image = '.\images\Start_Image.png'

        # Connect Events
        self.Bind(wx.EVT_ACTIVATE, lambda x: self.LoadStarterImage() )
        self.Cmd_GoLink.Bind(wx.EVT_BUTTON, lambda x: self.GoLink(self.Txt_Link.GetValue()))
        self.Cmd_RefreshPg.Bind(wx.EVT_BUTTON, lambda x: self.LoadStarterImage())

        self.Dir_Img.Bind(wx.EVT_FILEPICKER_CHANGED, lambda x: self.GoOpenImage(self.Dir_Img.GetPath()))

        self.Show()
Exemple #22
0
    def _init_ui(self):
        def on_reload(event):
            self.choice.SetItems(self._get_serial_ports())

        def on_clicked(event):
            self.console_ctrl.SetValue("")
            worker = FlashingThread(self, self._firmware, self._port)
            worker.start()

        def on_logs_clicked(event):
            self.console_ctrl.SetValue("")
            worker = FlashingThread(self, 'dummy', self._port, show_logs=True)
            worker.start()

        def on_select_port(event):
            choice = event.GetEventObject()
            self._port = choice.GetString(choice.GetSelection())

        def on_pick_file(event):
            self._firmware = event.GetPath().replace("'", "")

        panel = wx.Panel(self)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        fgs = wx.FlexGridSizer(7, 2, 10, 10)

        self.choice = wx.Choice(panel, choices=self._get_serial_ports())
        self.choice.Bind(wx.EVT_CHOICE, on_select_port)
        bmp = Reload.GetBitmap()
        reload_button = wx.BitmapButton(panel, id=wx.ID_ANY, bitmap=bmp,
                                        size=(bmp.GetWidth() + 7, bmp.GetHeight() + 7))
        reload_button.Bind(wx.EVT_BUTTON, on_reload)
        reload_button.SetToolTip("Reload serial device list")

        file_picker = wx.FilePickerCtrl(panel, style=wx.FLP_USE_TEXTCTRL)
        file_picker.Bind(wx.EVT_FILEPICKER_CHANGED, on_pick_file)

        serial_boxsizer = wx.BoxSizer(wx.HORIZONTAL)
        serial_boxsizer.Add(self.choice, 1, wx.EXPAND)
        serial_boxsizer.AddStretchSpacer(0)
        serial_boxsizer.Add(reload_button, 0, wx.ALIGN_NOT, 20)

        button = wx.Button(panel, -1, "Flash ESP")
        button.Bind(wx.EVT_BUTTON, on_clicked)

        logs_button = wx.Button(panel, -1, "View Logs")
        logs_button.Bind(wx.EVT_BUTTON, on_logs_clicked)

        self.console_ctrl = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
        self.console_ctrl.SetFont(wx.Font((0, 13), wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL,
                                          wx.FONTWEIGHT_NORMAL))
        self.console_ctrl.SetBackgroundColour(wx.BLACK)
        self.console_ctrl.SetForegroundColour(wx.WHITE)
        self.console_ctrl.SetDefaultStyle(wx.TextAttr(wx.WHITE))

        port_label = wx.StaticText(panel, label="Serial port")
        file_label = wx.StaticText(panel, label="Firmware")

        console_label = wx.StaticText(panel, label="Console")

        fgs.AddMany([
            # Port selection row
            port_label, (serial_boxsizer, 1, wx.EXPAND),
            # Firmware selection row (growable)
            file_label, (file_picker, 1, wx.EXPAND),
            # Flash ESP button
            (wx.StaticText(panel, label="")), (button, 1, wx.EXPAND),
            # View Logs button
            (wx.StaticText(panel, label="")), (logs_button, 1, wx.EXPAND),
            # Console View (growable)
            (console_label, 1, wx.EXPAND), (self.console_ctrl, 1, wx.EXPAND),
        ])
        fgs.AddGrowableRow(4, 1)
        fgs.AddGrowableCol(1, 1)
        hbox.Add(fgs, proportion=2, flag=wx.ALL | wx.EXPAND, border=15)
        panel.SetSizer(hbox)
Exemple #23
0
    def __init__(self, parent):
        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title=u"Krypter",
                          pos=wx.DefaultPosition,
                          size=wx.Size(500, 300),
                          style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

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

        bSizer8 = wx.BoxSizer(wx.VERTICAL)

        gSizer5 = wx.GridSizer(0, 2, 0, 0)

        self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"MyLabel",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText6.Wrap(-1)

        gSizer5.Add(self.m_staticText6, 0, wx.ALL, 5)

        self.m_filePicker4 = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString,
                                               u"Select a file", u"*.*",
                                               wx.DefaultPosition,
                                               wx.DefaultSize,
                                               wx.FLP_DEFAULT_STYLE)
        gSizer5.Add(self.m_filePicker4, 0, wx.ALL, 5)

        bSizer8.Add(gSizer5, 1, wx.EXPAND, 5)

        bSizer14 = wx.BoxSizer(wx.VERTICAL)

        self.m_button10 = wx.Button(self, wx.ID_ANY, u"krypter",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
        bSizer14.Add(self.m_button10, 0, wx.ALL, 5)

        self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"Key:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText7.Wrap(-1)

        bSizer14.Add(self.m_staticText7, 0, wx.ALL, 5)

        self.m_staticText8 = wx.StaticText(self, wx.ID_ANY, u"MyLabel",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText8.Wrap(-1)

        bSizer14.Add(self.m_staticText8, 0, wx.ALL, 5)

        self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"Dummy key:",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText9.Wrap(-1)

        bSizer14.Add(self.m_staticText9, 0, wx.ALL, 5)

        self.m_staticText10 = wx.StaticText(self, wx.ID_ANY, u"MyLabel",
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.m_staticText10.Wrap(-1)

        bSizer14.Add(self.m_staticText10, 0, wx.ALL, 5)

        bSizer8.Add(bSizer14, 1, wx.EXPAND, 5)

        self.SetSizer(bSizer8)
        self.Layout()

        self.Centre(wx.BOTH)
    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_PATH))
        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)

        config_file = auxiliaryfunctions.read_config(self.config)

        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 = [
            "dlcrnet_ms5",
            "resnet_50",
            "resnet_101",
            "resnet_152",
            "mobilenet_v2_1.0",
            "mobilenet_v2_0.75",
            "mobilenet_v2_0.5",
            "mobilenet_v2_0.35",
            "efficientnet-b0",
            "efficientnet-b3",
            "efficientnet-b6",
        ]
        self.net_choice.Set(options)
        self.net_choice.SetValue("dlcrnet_ms5")
        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("imgaug")
        augboxsizer.Add(self.aug_choice, 20, wx.EXPAND | wx.TOP | wx.BOTTOM,
                        10)

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

        shuffle_text = wx.StaticBox(
            self, label="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="User feedback (to confirm overwrite train/test split)?",
            choices=["Yes", "No"],
            majorDimension=1,
            style=wx.RA_SPECIFY_COLS,
        )
        self.userfeedback.SetSelection(1)

        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.hbox3.Add(self.userfeedback, 10, wx.EXPAND | wx.TOP | wx.BOTTOM,
                       5)

        if config_file.get("multianimalproject", False):

            self.model_comparison_choice = "No"
        else:
            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",
                "efficientnet-b0",
                "efficientnet-b3",
                "efficientnet-b6",
            ]
            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()
Exemple #25
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.Size(-1, -1),
                 style=wx.TAB_TRAVERSAL,
                 name=wx.EmptyString):
        wx.Panel.__init__(self,
                          parent,
                          id=id,
                          pos=pos,
                          size=size,
                          style=style,
                          name=name)

        bSizer42 = wx.BoxSizer(wx.VERTICAL)

        sbSizer7 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Netlist or xml file"), wx.VERTICAL)

        self.netlistFilePicker = wx.FilePickerCtrl(
            sbSizer7.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            u"Select a file",
            u"Netlist and xml files (*.net; *.xml)|*.net;*.xml",
            wx.DefaultPosition, wx.DefaultSize,
            wx.FLP_DEFAULT_STYLE | wx.FLP_FILE_MUST_EXIST | wx.FLP_OPEN
            | wx.FLP_SMALL | wx.FLP_USE_TEXTCTRL | wx.BORDER_SIMPLE)
        sbSizer7.Add(self.netlistFilePicker, 0,
                     wx.EXPAND | wx.BOTTOM | wx.RIGHT | wx.LEFT, 5)

        bSizer42.Add(sbSizer7, 0, wx.ALL | wx.EXPAND, 5)

        extraFieldsSizer = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Extra fields"), wx.VERTICAL)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer6 = wx.BoxSizer(wx.VERTICAL)

        extraFieldsListChoices = []
        self.extraFieldsList = wx.CheckListBox(extraFieldsSizer.GetStaticBox(),
                                               wx.ID_ANY, wx.DefaultPosition,
                                               wx.DefaultSize,
                                               extraFieldsListChoices,
                                               0 | wx.BORDER_SIMPLE)
        bSizer6.Add(self.extraFieldsList, 1, wx.ALL | wx.EXPAND, 5)

        bSizer4.Add(bSizer6, 1, wx.EXPAND, 5)

        bSizer5 = wx.BoxSizer(wx.VERTICAL)

        self.m_button1 = wx.Button(extraFieldsSizer.GetStaticBox(),
                                   wx.ID_ANY, u"Up", wx.DefaultPosition,
                                   wx.Size(30, 30), 0 | wx.BORDER_DEFAULT)
        bSizer5.Add(self.m_button1, 0, wx.ALL, 5)

        self.m_button2 = wx.Button(extraFieldsSizer.GetStaticBox(),
                                   wx.ID_ANY, u"Dn", wx.DefaultPosition,
                                   wx.Size(30, 30), 0 | wx.BORDER_DEFAULT)
        bSizer5.Add(self.m_button2, 0, wx.ALL, 5)

        bSizer4.Add(bSizer5, 0, wx.ALIGN_RIGHT, 5)

        extraFieldsSizer.Add(bSizer4, 1, wx.EXPAND, 5)

        bSizer42.Add(extraFieldsSizer, 2, wx.ALL | wx.EXPAND, 5)

        sbSizer32 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"Board variant"), wx.VERTICAL)

        self.m_staticText5 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Board variant field name",
                                           wx.DefaultPosition, wx.DefaultSize,
                                           0)
        self.m_staticText5.Wrap(-1)

        sbSizer32.Add(self.m_staticText5, 0, wx.ALL, 5)

        boardVariantFieldBoxChoices = []
        self.boardVariantFieldBox = wx.ComboBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.EmptyString,
            wx.DefaultPosition, wx.DefaultSize, boardVariantFieldBoxChoices,
            wx.CB_READONLY | wx.CB_SORT | wx.BORDER_SIMPLE)
        sbSizer32.Add(self.boardVariantFieldBox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer17 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer18 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText6 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Whitelist", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText6.Wrap(-1)

        bSizer18.Add(self.m_staticText6, 0, wx.ALL, 5)

        boardVariantWhitelistChoices = []
        self.boardVariantWhitelist = wx.CheckListBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition,
            wx.DefaultSize, boardVariantWhitelistChoices, 0 | wx.BORDER_SIMPLE)
        bSizer18.Add(self.boardVariantWhitelist, 1, wx.ALL | wx.EXPAND, 5)

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

        bSizer19 = wx.BoxSizer(wx.VERTICAL)

        self.m_staticText7 = wx.StaticText(sbSizer32.GetStaticBox(), wx.ID_ANY,
                                           u"Blacklist", wx.DefaultPosition,
                                           wx.DefaultSize, 0)
        self.m_staticText7.Wrap(-1)

        bSizer19.Add(self.m_staticText7, 0, wx.ALL, 5)

        boardVariantBlacklistChoices = []
        self.boardVariantBlacklist = wx.CheckListBox(
            sbSizer32.GetStaticBox(), wx.ID_ANY, wx.DefaultPosition,
            wx.DefaultSize, boardVariantBlacklistChoices, 0 | wx.BORDER_SIMPLE)
        bSizer19.Add(self.boardVariantBlacklist, 1, wx.ALL | wx.EXPAND, 5)

        bSizer17.Add(bSizer19, 1, wx.EXPAND, 5)

        sbSizer32.Add(bSizer17, 1, wx.EXPAND, 5)

        bSizer42.Add(sbSizer32, 3, wx.ALL | wx.EXPAND, 5)

        sbSizer8 = wx.StaticBoxSizer(
            wx.StaticBox(self, wx.ID_ANY, u"DNP field name"), wx.VERTICAL)

        self.m_staticText4 = wx.StaticText(
            sbSizer8.GetStaticBox(), wx.ID_ANY,
            u"Components with this field not empty will be ignored",
            wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_staticText4.Wrap(-1)

        sbSizer8.Add(self.m_staticText4, 0, wx.ALL, 5)

        dnpFieldBoxChoices = []
        self.dnpFieldBox = wx.ComboBox(
            sbSizer8.GetStaticBox(), wx.ID_ANY, u"-None-", wx.DefaultPosition,
            wx.DefaultSize, dnpFieldBoxChoices,
            wx.CB_READONLY | wx.CB_SORT | wx.BORDER_NONE)
        sbSizer8.Add(self.dnpFieldBox, 0, wx.ALL | wx.EXPAND, 5)

        bSizer42.Add(sbSizer8, 0, wx.ALL | wx.EXPAND, 5)

        self.SetSizer(bSizer42)
        self.Layout()
        bSizer42.Fit(self)

        # Connect Events
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.netlistFilePicker.Bind(wx.EVT_FILEPICKER_CHANGED,
                                    self.OnNetlistFileChanged)
        self.m_button1.Bind(wx.EVT_BUTTON, self.OnExtraFieldsUp)
        self.m_button2.Bind(wx.EVT_BUTTON, self.OnExtraFieldsDown)
        self.boardVariantFieldBox.Bind(wx.EVT_COMBOBOX,
                                       self.OnBoardVariantFieldChange)
    def __init__(self, parent, title):
        super(acqAndTrainModelWindow, self).__init__(parent,
                                                     title=title,
                                                     size=(615, 360))
        self.Centre()
        panel = wx.Panel(self)

        dataWildcard = "npz Data File (.npz)" + "|*.npz"

        # Accquisition Session box
        sbox1 = wx.StaticBox(panel, -1, label=u'校准阶段')
        self.sbsizer1 = wx.StaticBoxSizer(sbox1, wx.VERTICAL)
        gridSizer1 = wx.FlexGridSizer(cols=3, vgap=10, hgap=1)

        self.accquDataPath = wx.DirPickerCtrl(panel, size=(327, 27))
        self.accquDataPath.GetPickerCtrl().SetLabel('浏览')
        label = wx.StaticText(panel)
        label.SetLabel("校准数据存储路径:")
        gridSizer1.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        gridSizer1.Add(self.accquDataPath, 0,
                       wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.AccStartBtn = wx.Button(panel,
                                     label="开始校准任务",
                                     size=wx.Size(100, 27))
        self.AccStartBtn.Bind(wx.EVT_BUTTON, self.OnAcqStart)
        gridSizer1.Add(self.AccStartBtn, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                       5)
        self.sbsizer1.Add(gridSizer1, proportion=0, flag=wx.ALL, border=5)

        # Train Model box
        sbox2 = wx.StaticBox(panel, -1, label=u'模型训练')
        self.sbsizer2 = wx.StaticBoxSizer(sbox2, wx.VERTICAL)
        gridSizer2 = wx.FlexGridSizer(cols=3, vgap=10, hgap=1)

        self.TrainDataPath = wx.FilePickerCtrl(panel,
                                               wildcard=dataWildcard,
                                               size=(350, 27))
        self.TrainDataPath.GetPickerCtrl().SetLabel('浏览')
        label = wx.StaticText(panel)
        label.SetLabel("选择训练数据:")
        gridSizer2.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        gridSizer2.Add(self.TrainDataPath, 0,
                       wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.statusLabel = wx.StaticText(panel)
        self.statusLabel.SetLabel("")
        gridSizer2.Add(self.statusLabel, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL,
                       5)

        self.TrainModelPath = wx.DirPickerCtrl(panel, size=(350, 27))
        self.TrainModelPath.GetPickerCtrl().SetLabel('浏览')
        label = wx.StaticText(panel)
        label.SetLabel("模型存储路径:")
        gridSizer2.Add(label, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        gridSizer2.Add(self.TrainModelPath, 0,
                       wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)

        self.TrainModelBtn = wx.Button(panel,
                                       label="模型训练开始",
                                       size=wx.Size(100, 27))
        self.TrainModelBtn.Bind(wx.EVT_BUTTON, self.OnTrainModel)
        gridSizer2.Add(self.TrainModelBtn, 0,
                       wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
        self.sbsizer2.Add(gridSizer2, proportion=0, flag=wx.ALL, border=5)

        self.backBtn = wx.Button(panel, label="返回", size=(100, 27))
        self.backBtn.Bind(wx.EVT_BUTTON, self.OnBack)

        gridSizer = wx.FlexGridSizer(cols=1, vgap=1, hgap=1)
        gridSizer.Add(self.backBtn, 0, wx.ALL, 5)
        gridSizer.Add(self.sbsizer1, 0, wx.ALL, 5)
        gridSizer.Add(self.sbsizer2, 0, wx.ALL, 5)
        panel.SetSizerAndFit(gridSizer)
        panel.Center()
        self.Fit()
    def __init__(self, parent, gui_size, cfg):
        """Constructor"""
        wx.Panel.__init__(self, parent=parent)
        self.config = cfg
        self.cfg = auxiliaryfunctions.read_config(self.config)
        self.datafile = ""
        self.video = ""
        self.manager = None
        self.viz = None
        # design the panel
        sizer = wx.GridBagSizer(5, 5)

        text = wx.StaticText(self,
                             label="DeepLabCut - OPTIONAL Refine Tracklets")
        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_PATH))
        sizer.Add(icon,
                  pos=(0, 4),
                  flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT,
                  border=5)

        line1 = wx.StaticLine(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")
        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")
        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)

        self.ntracks_text = wx.StaticText(self, label="Number of animals")
        sizer.Add(self.ntracks_text,
                  pos=(3, 0),
                  flag=wx.TOP | wx.LEFT,
                  border=5)
        self.ntracks = wx.SpinCtrl(self,
                                   value=str(len(self.cfg["individuals"])),
                                   min=1,
                                   max=1000)
        sizer.Add(self.ntracks,
                  pos=(3, 1),
                  span=(1, 3),
                  flag=wx.EXPAND | wx.TOP,
                  border=5)

        self.video_text = wx.StaticText(self, label="Select the video")
        sizer.Add(self.video_text, pos=(4, 0), flag=wx.TOP | wx.LEFT, border=5)
        self.sel_video = wx.FilePickerCtrl(self,
                                           path="",
                                           style=wx.FLP_USE_TEXTCTRL,
                                           message="Open video")
        sizer.Add(self.sel_video,
                  pos=(4, 1),
                  span=(1, 3),
                  flag=wx.TOP | wx.EXPAND,
                  border=5)
        self.sel_video.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_video)

        vbox_ = wx.BoxSizer(wx.VERTICAL)
        hbox_ = wx.BoxSizer(wx.HORIZONTAL)
        videotype_text = wx.StaticBox(self, label="Specify the videotype")
        videotype_text_boxsizer = wx.StaticBoxSizer(videotype_text,
                                                    wx.VERTICAL)
        videotypes = [".avi", ".mp4", ".mov"]
        self.videotype = wx.ComboBox(self,
                                     choices=videotypes,
                                     style=wx.CB_READONLY)
        self.videotype.SetValue(".avi")
        videotype_text_boxsizer.Add(self.videotype, 1,
                                    wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        shuffle_text = wx.StaticBox(self, label="Specify the shuffle")
        shuffle_boxsizer = wx.StaticBoxSizer(shuffle_text, wx.VERTICAL)
        self.shuffle = wx.SpinCtrl(self, value="1", min=0, max=100)
        shuffle_boxsizer.Add(self.shuffle, 1, wx.EXPAND | wx.TOP | wx.BOTTOM,
                             10)

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

        hbox_.Add(videotype_text_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM,
                  5)
        hbox_.Add(shuffle_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        #hbox_.Add(trainingset_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        vbox_.Add(hbox_)
        sizer.Add(vbox_, pos=(5, 0))

        self.create_tracks_btn = wx.Button(self,
                                           label="Run(or re-run) tracking")
        sizer.Add(self.create_tracks_btn, pos=(6, 1))
        self.create_tracks_btn.Bind(wx.EVT_BUTTON, self.create_tracks)

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

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        slider_swap_text = wx.StaticBox(
            self, label="Specify the min swap length to highlight")
        slider_swap_sizer = wx.StaticBoxSizer(slider_swap_text, wx.VERTICAL)
        self.slider_swap = wx.SpinCtrl(self, value="2")
        slider_swap_sizer.Add(self.slider_swap, 20,
                              wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        hbox.Add(slider_swap_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        sizer.Add(hbox,
                  pos=(8, 0),
                  flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                  border=10)

        hbox_ = wx.BoxSizer(wx.HORIZONTAL)

        slider_gap_text = wx.StaticBox(
            self, label="Specify the max gap size of missing data to fill")
        slider_gap_sizer = wx.StaticBoxSizer(slider_gap_text, wx.VERTICAL)
        self.slider_gap = wx.SpinCtrl(self, value="5")
        slider_gap_sizer.Add(self.slider_gap, 20,
                             wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        hbox_.Add(slider_gap_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        traillength_text = wx.StaticBox(
            self, label="Trail Length (for visualization)")
        traillength_sizer = wx.StaticBoxSizer(traillength_text, wx.VERTICAL)
        self.length_track = wx.SpinCtrl(self, value="25")
        traillength_sizer.Add(self.length_track, 20,
                              wx.EXPAND | wx.TOP | wx.BOTTOM, 10)
        hbox_.Add(traillength_sizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)

        sizer.Add(hbox_,
                  pos=(9, 0),
                  flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                  border=10)

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

        hbox2 = wx.BoxSizer(wx.HORIZONTAL)

        filter_text = wx.StaticBox(self, label="filter type")
        filter_sizer = wx.StaticBoxSizer(filter_text, wx.VERTICAL)
        filtertypes = ["median"]
        self.filter_track = wx.ComboBox(self,
                                        choices=filtertypes,
                                        style=wx.CB_READONLY)
        self.filter_track.SetValue("median")
        filter_sizer.Add(self.filter_track, 20, wx.EXPAND | wx.TOP | wx.BOTTOM,
                         10)

        filterlength_text = wx.StaticBox(self, label="filter: window length")
        filterlength_sizer = wx.StaticBoxSizer(filterlength_text, wx.VERTICAL)
        self.filterlength_track = wx.SpinCtrl(self, value="5")
        filterlength_sizer.Add(self.filterlength_track, 20,
                               wx.EXPAND | wx.TOP | wx.BOTTOM, 10)

        hbox2.Add(filter_sizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        hbox2.Add(filterlength_sizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
        sizer.Add(hbox2,
                  pos=(11, 0),
                  flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT,
                  border=10)

        self.inf_cfg_text = wx.Button(self, label="Edit inference_config.yaml")
        sizer.Add(self.inf_cfg_text,
                  pos=(12, 2),
                  flag=wx.BOTTOM | wx.RIGHT,
                  border=10)
        self.inf_cfg_text.Bind(wx.EVT_BUTTON, self.edit_inf_config)

        self.ok = wx.Button(self, label="Refine tracks GUI Launch")
        sizer.Add(self.ok, pos=(9, 1))
        self.ok.Bind(wx.EVT_BUTTON, self.refine_tracklets)

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

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

        self.filter = wx.Button(
            self,
            label=" Optional: Filter Tracks (then you also get a CSV file!)")
        sizer.Add(self.filter,
                  pos=(11, 1),
                  flag=wx.BOTTOM | wx.RIGHT,
                  border=10)
        self.filter.Bind(wx.EVT_BUTTON, self.filter_after_refinement)

        self.export = wx.Button(
            self, label="Optional: Merge refined data into training set")
        sizer.Add(self.export,
                  pos=(13, 1),
                  flag=wx.BOTTOM | wx.RIGHT,
                  border=10)
        self.export.Bind(wx.EVT_BUTTON, self.export_data)
        self.export.Disable()

        sizer.AddGrowableCol(2)

        self.SetSizer(sizer)
        sizer.Fit(self)
Exemple #28
0
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"NDVI", pos = wx.DefaultPosition, size = wx.Size( 1005,611 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
		
		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
		
		self.m_menubar = wx.MenuBar( 0 )
		self.m_menubar.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
		self.m_menubar.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOW ) )
		
		self.file_menu = wx.Menu()
		self.close_menu = wx.MenuItem( self.file_menu, wx.ID_ANY, u"Close", wx.EmptyString, wx.ITEM_NORMAL )
		self.file_menu.Append( self.close_menu )
		
		self.m_menubar.Append( self.file_menu, u"File" ) 
		
		self.help_menu = wx.Menu()
		self.about_menu = wx.MenuItem( self.help_menu, wx.ID_ANY, u"About", wx.EmptyString, wx.ITEM_NORMAL )
		self.help_menu.Append( self.about_menu )
		
		self.m_menubar.Append( self.help_menu, u"Help" ) 
		
		self.SetMenuBar( self.m_menubar )
		
		bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText5.Wrap( -1 )
		bSizer1.Add( self.m_staticText5, 0, wx.ALL, 5 )
		
		bSizer2 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText4.Wrap( -1 )
		bSizer2.Add( self.m_staticText4, 0, wx.ALL, 5 )
		
		sbSizer_Red = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Red" ), wx.VERTICAL )
		
		self.img_red_bitmap = wx.StaticBitmap( sbSizer_Red.GetStaticBox(), wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 200,200 ), 0 )
		self.img_red_bitmap.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DDKSHADOW ) )
		
		sbSizer_Red.Add( self.img_red_bitmap, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
		
		self.browse_btn = wx.Button( sbSizer_Red.GetStaticBox(), wx.ID_ANY, u"Browse Image", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer_Red.Add( self.browse_btn, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
		
		
		bSizer2.Add( sbSizer_Red, 1, wx.EXPAND, 5 )
		
		self.m_staticText45 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText45.Wrap( -1 )
		bSizer2.Add( self.m_staticText45, 0, wx.ALL, 5 )
		
		sbSizer_cropping = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Coordinate Cropping" ), wx.VERTICAL )
		
		bSizer11 = wx.BoxSizer( wx.HORIZONTAL )
		
		bSizer_startlat = wx.BoxSizer( wx.VERTICAL )
		
		self.startlat_txt = wx.StaticText( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, u"Start Latitude", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.startlat_txt.Wrap( -1 )
		bSizer_startlat.Add( self.startlat_txt, 0, wx.ALL, 5 )
		
		self.startlat_txtCtrl = wx.TextCtrl( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer_startlat.Add( self.startlat_txtCtrl, 0, wx.ALL|wx.EXPAND, 5 )
		
		self.endlat_txt = wx.StaticText( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, u"End Latitude", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.endlat_txt.Wrap( -1 )
		bSizer_startlat.Add( self.endlat_txt, 0, wx.ALL, 5 )
		
		self.endlat_txtCtrl = wx.TextCtrl( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer_startlat.Add( self.endlat_txtCtrl, 0, wx.ALL|wx.EXPAND, 5 )
		
		
		bSizer11.Add( bSizer_startlat, 1, wx.EXPAND, 5 )
		
		bSizer9 = wx.BoxSizer( wx.VERTICAL )
		
		self.startlon_txt = wx.StaticText( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, u"Start Longitude", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.startlon_txt.Wrap( -1 )
		bSizer9.Add( self.startlon_txt, 0, wx.ALL, 5 )
		
		self.startlon_txtCtrl = wx.TextCtrl( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.startlon_txtCtrl, 0, wx.ALL|wx.EXPAND, 5 )
		
		self.endlon_txt = wx.StaticText( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, u"End Longitude", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.endlon_txt.Wrap( -1 )
		bSizer9.Add( self.endlon_txt, 0, wx.ALL, 5 )
		
		self.endlon_txtCtrl = wx.TextCtrl( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		bSizer9.Add( self.endlon_txtCtrl, 0, wx.ALL|wx.EXPAND, 5 )
		
		
		bSizer11.Add( bSizer9, 1, wx.EXPAND, 5 )
		
		
		sbSizer_cropping.Add( bSizer11, 1, wx.EXPAND, 5 )
		
		self.crop_btn = wx.Button( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, u"Crop", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer_cropping.Add( self.crop_btn, 0, wx.ALIGN_RIGHT|wx.ALL|wx.EXPAND, 5 )
		
		self.m_staticText436 = wx.StaticText( sbSizer_cropping.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText436.Wrap( -1 )
		sbSizer_cropping.Add( self.m_staticText436, 0, wx.ALL, 5 )
		
		
		bSizer2.Add( sbSizer_cropping, 1, wx.EXPAND, 5 )
		
		self.m_staticText435 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText435.Wrap( -1 )
		bSizer2.Add( self.m_staticText435, 0, wx.ALL, 5 )
		
		
		bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
		
		self.m_staticText51 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText51.Wrap( -1 )
		bSizer1.Add( self.m_staticText51, 0, wx.ALL, 5 )
		
		bSizer3 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_staticText41 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText41.Wrap( -1 )
		bSizer3.Add( self.m_staticText41, 0, wx.ALL, 5 )
		
		sbSizer_NIR = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"NIR" ), wx.VERTICAL )
		
		self.nir_bitmap = wx.StaticBitmap( sbSizer_NIR.GetStaticBox(), wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 200,200 ), 0 )
		self.nir_bitmap.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DDKSHADOW ) )
		
		sbSizer_NIR.Add( self.nir_bitmap, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
		
		self.browse_nir_btn = wx.Button( sbSizer_NIR.GetStaticBox(), wx.ID_ANY, u"Browse NIR Image", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer_NIR.Add( self.browse_nir_btn, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
		
		
		bSizer3.Add( sbSizer_NIR, 1, wx.EXPAND, 5 )
		
		self.m_staticText451 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText451.Wrap( -1 )
		bSizer3.Add( self.m_staticText451, 0, wx.ALL, 5 )
		
		sbSizer_metadata = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Metadata" ), wx.VERTICAL )
		
		bSizer13 = wx.BoxSizer( wx.VERTICAL )
		
		self.metadata_btn = wx.FilePickerCtrl( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, wx.EmptyString, u"Select Metadata", u"Text files (*.txt)|*.txt", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE )
		bSizer13.Add( self.metadata_btn, 0, wx.ALL, 5 )
		
		self.m_staticText26 = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText26.Wrap( -1 )
		bSizer13.Add( self.m_staticText26, 0, wx.ALL, 5 )

		bSizer92 = wx.BoxSizer( wx.HORIZONTAL )

		self.upleft_lat_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, u"Upper Left Latitude:", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.upleft_lat_txt.Wrap( -1 )
		bSizer92.Add( self.upleft_lat_txt, 0, wx.ALL, 5 )
		
		self.upleft_lat_static_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.upleft_lat_static_txt.Wrap( -1 )
		bSizer92.Add( self.upleft_lat_static_txt, 0, wx.ALL, 5 )

		bSizer93 = wx.BoxSizer( wx.HORIZONTAL )

		self.upleft_lon_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, u"Upper Left Longitude:", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.upleft_lon_txt.Wrap( -1 )
		bSizer93.Add( self.upleft_lon_txt, 0, wx.ALL, 5 )
		
		self.upleft_lon_static_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.upleft_lon_static_txt.Wrap( -1 )
		bSizer93.Add( self.upleft_lon_static_txt, 0, wx.ALL, 5 )

		bSizer94 = wx.BoxSizer( wx.HORIZONTAL )

		self.lowright_lat_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, u"Lower Right Latitude:", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.lowright_lat_txt.Wrap( -1 )
		bSizer94.Add( self.lowright_lat_txt, 0, wx.ALL, 5 )
		
		self.lowright_lat_static_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.lowright_lat_static_txt.Wrap( -1 )
		bSizer94.Add( self.lowright_lat_static_txt, 0, wx.ALL, 5 )

		bSizer95 = wx.BoxSizer( wx.HORIZONTAL )

		self.lowright_lon_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, u"Lower Right Longitude:", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.lowright_lon_txt.Wrap( -1 )
		bSizer95.Add( self.lowright_lon_txt, 0, wx.ALL, 5 )
		
		self.lowright_lon_static_txt = wx.StaticText( sbSizer_metadata.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.lowright_lon_static_txt.Wrap( -1 )
		bSizer95.Add( self.lowright_lon_static_txt, 0, wx.ALL, 5 )	
		
		bSizer13.Add( bSizer92, 1, wx.EXPAND, 5 )
		bSizer13.Add( bSizer93, 1, wx.EXPAND, 5 )
		bSizer13.Add( bSizer94, 1, wx.EXPAND, 5 )
		bSizer13.Add( bSizer95, 1, wx.EXPAND, 5 )
		
		
		sbSizer_metadata.Add( bSizer13, 1, wx.EXPAND, 5 )
		
		
		bSizer3.Add( sbSizer_metadata, 1, wx.EXPAND, 5 )
		
		self.m_staticText433 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText433.Wrap( -1 )
		bSizer3.Add( self.m_staticText433, 0, wx.ALL, 5 )
		
		
		bSizer1.Add( bSizer3, 1, wx.EXPAND, 5 )
		
		self.m_staticText43 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText43.Wrap( -1 )
		bSizer1.Add( self.m_staticText43, 0, wx.ALL, 5 )
		
		bSizer4 = wx.BoxSizer( wx.VERTICAL )
		
		self.m_staticText42 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText42.Wrap( -1 )
		bSizer4.Add( self.m_staticText42, 0, wx.ALL, 5 )
		
		sbSizer_NDVI = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"NDVI" ), wx.VERTICAL )
		
		self.ndvi_bitmap = wx.StaticBitmap( sbSizer_NDVI.GetStaticBox(), wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.Size( 200,200 ), 0 )
		self.ndvi_bitmap.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DDKSHADOW ) )
		
		sbSizer_NDVI.Add( self.ndvi_bitmap, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
		
		self.ndvi_btn = wx.Button( sbSizer_NDVI.GetStaticBox(), wx.ID_ANY, u"Start NDVI", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer_NDVI.Add( self.ndvi_btn, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
		
		
		bSizer4.Add( sbSizer_NDVI, 1, wx.EXPAND, 5 )
		
		self.m_staticText431 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText431.Wrap( -1 )
		bSizer4.Add( self.m_staticText431, 0, wx.ALL, 5 )
		
		sbSizer8 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"File" ), wx.VERTICAL )
		
		self.save_btn = wx.Button( sbSizer8.GetStaticBox(), wx.ID_ANY, u"Save Image", wx.DefaultPosition, wx.DefaultSize, 0 )
		sbSizer8.Add( self.save_btn, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
		
		
		bSizer4.Add( sbSizer8, 1, wx.EXPAND, 5 )
		
		self.m_staticText432 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText432.Wrap( -1 )
		bSizer4.Add( self.m_staticText432, 0, wx.ALL, 5 )
		
		
		bSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
		
		self.m_staticText434 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_staticText434.Wrap( -1 )
		bSizer1.Add( self.m_staticText434, 0, wx.ALL, 5 )
		
		
		self.SetSizer( bSizer1 )
		self.Layout()
		
		self.Centre( wx.BOTH )
		
		# Connect Events
		self.Bind( wx.EVT_MENU, self.close, id = self.close_menu.GetId() )
		self.Bind( wx.EVT_MENU, self.about, id = self.about_menu.GetId() )
		self.browse_btn.Bind( wx.EVT_BUTTON, self.browseImage )
		self.crop_btn.Bind( wx.EVT_BUTTON, self.cropCoordinate )
		self.browse_nir_btn.Bind( wx.EVT_BUTTON, self.browseNIR )
		self.metadata_btn.Bind( wx.EVT_FILEPICKER_CHANGED, self.browseMetadata )
		self.ndvi_btn.Bind( wx.EVT_BUTTON, self.onStartNDVI )
		self.save_btn.Bind( wx.EVT_BUTTON, self.saveImage )

		self.ndvi = NDVI()
		self.ndvi.SetOnProcessFinishListener(self)
Exemple #29
0
    def __init__(self, parent=None, title='my title', size=(800, 600)):
        """
        build wxpython frame, including it's layout,event,control
        :param parent: none
        :param title: software name
        :param size: softsware size
        """
        wx.Frame.__init__(self, parent=parent, title=title, size=size)
        self.Centre()
        self.panel = wx.Panel(self, -1)
        self.gauge_count = 0
        self.log_is_begin = True

        self.model_archi = ''
        self.model_weigh = ''
        self.input_files_path = ''
        self.output_path = ''
        '''text,button'''
        self.text_intro = wx.StaticText(self.panel,
                                        -1,
                                        'Clothes-classfier by deep learning',
                                        pos=(180, 0))
        # self.text_intro.SetBackgroundColour('green')
        self.text_intro.SetFont(wx.Font(26, wx.SWISS, wx.NORMAL, wx.BOLD))
        self.text_line = wx.StaticLine(self.panel)

        self.text_archi = wx.StaticText(self.panel, -1,
                                        'load model architecture:')
        self.text_archi.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
        self.text_weigh = wx.StaticText(self.panel, -1, 'load model weights:')
        self.load_model_archi = wx.FilePickerCtrl(
            self.panel,
            2,
            wildcard='*.json',
            path='path_to_model_architecture(*.json)',
            size=(400, -1))
        self.load_model_weigh = wx.FilePickerCtrl(
            self.panel,
            3,
            wildcard='*.h5',
            path='path_to_model_weights(*.h5)',
            size=(400, -1))

        self.text_load_pic = wx.StaticText(
            self.panel, -1, 'pictures folder(must only contain pictures):')
        self.text_res_output = wx.StaticText(self.panel, -1,
                                             'result output folder:')
        self.load_pic = wx.DirPickerCtrl(
            self.panel,
            4,
            path='path_to_pic',
            size=(400, -1),
            message='input must be dir')  #message is tips when browse path
        self.output_res = wx.DirPickerCtrl(self.panel,
                                           4,
                                           path='output_result',
                                           size=(400, -1),
                                           message='output must be dir')

        self.text_output_name = wx.StaticText(
            self.panel, -1, 'save predict result name(*.csv):')
        self.ctrl_output_name = wx.TextCtrl(self.panel, -1)
        self.ctrl_output_name_button = wx.Button(self.panel, -1, 'save')

        self.gauge_training = wx.Gauge(self.panel, -1)
        self.text_logging = wx.StaticText(self.panel, -1, 'process log:')
        self.logging_output = wx.TextCtrl(self.panel,
                                          -1,
                                          style=wx.TE_MULTILINE | wx.TE_RICH,
                                          size=(400, 80))

        # self.button_clf = wx.Button(self.panel,-1,'Classify',size=(100,100),)
        self.button_clf = wx.ToggleButton(self.panel, -1, 'Classify')
        self.button_clf.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD))
        # self.button_clf.SetBackgroundColour('AQUAMARINE')
        '''event'''
        self.load_model_archi.Bind(wx.EVT_FILEPICKER_CHANGED,
                                   self.event_getpath, self.load_model_archi)
        self.load_model_weigh.Bind(wx.EVT_FILEPICKER_CHANGED,
                                   self.event_getpath, self.load_model_weigh)

        self.load_pic.Bind(wx.EVT_DIRPICKER_CHANGED, self.event_getpath,
                           self.load_pic)
        self.output_res.Bind(wx.EVT_DIRPICKER_CHANGED, self.event_getpath,
                             self.output_res)

        # self.ctrl_output_name.Bind(wx.EVT_TEXT,self.on_text_path)
        self.ctrl_output_name_button.Bind(wx.EVT_BUTTON,
                                          self.on_text_path_sure)

        self.gauge_training.Bind(wx.EVT_IDLE, self.do_gauge)

        self.button_clf.Bind(wx.EVT_TOGGLEBUTTON, self.begin_classify,
                             self.button_clf)

        # wx.CallAfter(self.dologging)
        '''get info for model'''
        self.model_archi = self.load_model_archi.GetPath()
        self.model_weigh = self.load_model_weigh.GetPath()
        self.input_files_path = self.load_pic.GetPath()
        self.output_path = self.output_res.GetPath()
        self.output_csv_name = ''
        """layout"""
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(self.text_intro, 0, flag=wx.CENTER)
        main_sizer.Add(self.text_line, 0, flag=wx.EXPAND)
        main_sizer.Add((20, 20))

        left_sizer = wx.BoxSizer(wx.VERTICAL)
        left_sizer.Add(self.sizer_model_staticbox(
            'Load Model',
            text=[self.text_archi, self.text_weigh],
            item=[self.load_model_archi, self.load_model_weigh]),
                       1,
                       flag=wx.EXPAND)
        left_sizer.Add((10, 10))
        #ctrl_text and it's button
        left_down_sizer = wx.BoxSizer(wx.HORIZONTAL)
        left_down_sizer.Add(self.ctrl_output_name, 1, wx.EXPAND)

        left_down_sizer.Add(self.ctrl_output_name_button, 0)

        left_sizer.Add(self.sizer_model_staticbox(
            'Input-dir Output-file',
            text=[self.text_load_pic, self.text_res_output],
            item=[self.load_pic, self.output_res]),
                       1,
                       flag=wx.BOTTOM | wx.EXPAND | wx.ALL)

        left_sizer.Add((10, 10))
        left_sizer.Add(self.text_output_name, 0)
        left_sizer.Add(left_down_sizer, 0, wx.EXPAND)

        middle_sizer = wx.BoxSizer(wx.VERTICAL)
        middle_top_sizer = wx.BoxSizer(wx.VERTICAL)
        middle_top_sizer.Add(self.button_clf, 1, flag=wx.CENTER)
        middle_top_sizer.Add(self.gauge_training, 1, flag=wx.EXPAND)
        middle_sizer.Add(middle_top_sizer, 1, flag=wx.EXPAND)
        middle_sizer.Add((10, 10))
        log_box = wx.StaticBox(self.panel, -1, 'Result')
        logsizer = wx.StaticBoxSizer(log_box, wx.VERTICAL)
        logsizer.Add(self.sizer_load_model(self.text_logging,
                                           self.logging_output,
                                           flag=wx.EXPAND | wx.ALL),
                     1,
                     flag=wx.BOTTOM | wx.EXPAND | wx.ALL)
        middle_sizer.Add(logsizer, 1, flag=wx.BOTTOM | wx.EXPAND | wx.ALL)

        core_sizer = wx.BoxSizer(wx.HORIZONTAL)
        core_sizer.Add(left_sizer, 1, flag=wx.LEFT | wx.EXPAND | wx.ALL)
        core_sizer.Add(middle_sizer, 1, flag=wx.EXPAND | wx.ALL)

        main_sizer.Add(core_sizer, 1, wx.ALL, 5)
        self.panel.SetSizer(main_sizer)
        main_sizer.Fit(self)

        Publisher.subscribe(self.dologging, 'update')
        Publisher.subscribe(self.do_gauge, 'update_gauge')
Exemple #30
0
 def __init__(self):
     self.endcallback = None
     self.ser = None
     self.amiga = None
     self.execlib = None
     self.snip = None
     self.abort = threading.Event()
     self.wantclose = False
     self.busy = False
     self.drives = 4  #maximum we test for
     self.timerperiod = 50
     super().__init__(None,
                      id=wx.ID_ANY,
                      title=u"amigaXfer floppy tool",
                      pos=wx.DefaultPosition,
                      size=wx.Size(450, 340),
                      style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
     self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)
     self.SetBackgroundColour(
         wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT))
     bSizer1 = wx.BoxSizer(wx.VERTICAL)
     m_modeChoices = [u"ADF2Disk", u"Disk2ADF", u"Compare"]
     self.m_mode = wx.RadioBox(self, wx.ID_ANY, u"Mode", wx.DefaultPosition,
                               wx.DefaultSize, m_modeChoices, 1,
                               wx.RA_SPECIFY_ROWS)
     self.m_mode.SetSelection(0)
     self.m_mode.Bind(wx.EVT_RADIOBOX, self.onModeChange)
     bSizer1.Add(self.m_mode, 0, wx.ALL | wx.EXPAND, 5)
     wSizer7 = wx.WrapSizer(wx.HORIZONTAL, wx.WRAPSIZER_DEFAULT_FLAGS)
     m_driveChoices = [u"DF0:", u"DF1:", u"DF2:", u"DF3:"]
     self.m_drive = wx.RadioBox(self, wx.ID_ANY, u"Drive",
                                wx.DefaultPosition, wx.DefaultSize,
                                m_driveChoices, 1, wx.RA_SPECIFY_COLS)
     self.m_drive.SetSelection(0)
     wSizer7.Add(self.m_drive, 0, wx.ALL, 5)
     bSizer5 = wx.BoxSizer(wx.VERTICAL)
     m_verifyChoices = [u"None", u"Xfer", u"Read"]
     self.m_verify = wx.RadioBox(self, wx.ID_ANY, u"Verify",
                                 wx.DefaultPosition, wx.DefaultSize,
                                 m_verifyChoices, 1, wx.RA_SPECIFY_ROWS)
     self.m_verify.SetSelection(2)
     bSizer5.Add(self.m_verify, 0, wx.ALL, 5)
     wSizer10 = wx.WrapSizer(
         wx.HORIZONTAL,
         wx.EXTEND_LAST_ON_EACH_LINE | wx.WRAPSIZER_DEFAULT_FLAGS)
     self.m_adfsourcemsg = wx.StaticText(self, wx.ID_ANY, u"ADF Source",
                                         wx.DefaultPosition, wx.DefaultSize,
                                         0)
     self.m_adfsourcemsg.Wrap(-1)
     wSizer10.Add(self.m_adfsourcemsg, 0, wx.ALIGN_CENTER_VERTICAL, 5)
     self.m_adfsource = wx.FilePickerCtrl(
         self, wx.ID_ANY, wx.EmptyString, u"Select an ADF image",
         u"Amiga Disk File (.adf)|*.adf;*.ADF", wx.DefaultPosition,
         wx.DefaultSize, wx.FLP_DEFAULT_STYLE)
     self.m_adfsource.SetMinSize(wx.Size(300, -1))
     wSizer10.Add(self.m_adfsource, 0, wx.ALL, 5)
     bSizer5.Add(wSizer10, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
     wSizer102 = wx.WrapSizer(
         wx.HORIZONTAL,
         wx.EXTEND_LAST_ON_EACH_LINE | wx.WRAPSIZER_DEFAULT_FLAGS)
     self.m_adftargetmsg = wx.StaticText(self, wx.ID_ANY, u"ADF Target",
                                         wx.DefaultPosition, wx.DefaultSize,
                                         0)
     self.m_adftargetmsg.Wrap(-1)
     self.m_adftargetmsg.Hide()
     wSizer102.Add(self.m_adftargetmsg, 0, wx.ALIGN_CENTER_VERTICAL, 5)
     defaulttarget = wx.EmptyString
     self.m_adftarget = wx.FilePickerCtrl(
         self, wx.ID_ANY, defaulttarget, u"Select target ADF filename",
         u"Amiga Disk File (.adf)|*.adf;*.ADF", wx.DefaultPosition,
         wx.DefaultSize, wx.FLP_OVERWRITE_PROMPT | wx.FLP_SAVE
         | wx.FLP_SMALL | wx.FLP_USE_TEXTCTRL)
     self.m_adftarget.SetMinSize(wx.Size(300, -1))
     self.m_adftarget.Hide()
     wSizer102.Add(self.m_adftarget, 0, wx.ALL, 5)
     bSizer5.Add(wSizer102, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
     wSizer7.Add(bSizer5, 0, wx.ALL, 5)
     bSizer1.Add(wSizer7, 0, wx.ALL | wx.EXPAND, 5)
     self.m_progress = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition,
                                wx.DefaultSize,
                                wx.GA_HORIZONTAL | wx.GA_SMOOTH)
     self.m_progress.SetValue(0)
     bSizer1.Add(self.m_progress, 0, wx.ALL | wx.EXPAND, 5)
     wSizer16 = wx.WrapSizer(wx.HORIZONTAL, 0)
     self.m_crcmsg = wx.StaticText(self, wx.ID_ANY, u"Last CRC",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
     self.m_crcmsg.Wrap(-1)
     wSizer16.Add(self.m_crcmsg, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.m_crc = wx.TextCtrl(self, wx.ID_ANY, u"00000000",
                              wx.DefaultPosition, wx.DefaultSize,
                              wx.TE_READONLY)
     maxlen = 8
     self.m_crc.SetMaxLength(maxlen)
     self.m_crc.SetFont(
         wx.Font(wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_TELETYPE,
                 wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False,
                 wx.EmptyString))
     self.m_crc.SetInitialSize(
         self.m_crc.GetSizeFromTextSize(
             self.m_crc.GetTextExtent("A" * maxlen)))
     wSizer16.Add(self.m_crc, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.m_exit = wx.Button(self, wx.ID_ANY, u"Exit", wx.DefaultPosition,
                             wx.DefaultSize, 0)
     self.m_exit.Bind(wx.EVT_BUTTON, self.onExitPressed)
     wSizer16.Add(self.m_exit, 0, wx.ALL, 5)
     self.m_abort = wx.Button(self, wx.ID_ANY, u"Stop", wx.DefaultPosition,
                              wx.DefaultSize, 0)
     self.m_abort.Hide()
     self.m_abort.Bind(wx.EVT_BUTTON, self.onAbortPressed)
     wSizer16.Add(self.m_abort, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.m_start = wx.Button(self, wx.ID_ANY, u"Start", wx.DefaultPosition,
                              wx.DefaultSize, 0)
     self.m_start.Bind(wx.EVT_BUTTON, self.onStartPressed)
     wSizer16.Add(self.m_start, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     bSizer1.Add(wSizer16, 0, wx.ALIGN_RIGHT | wx.ALL, 5)
     wSizer101 = wx.WrapSizer(wx.HORIZONTAL, 0)
     maxlen = 10
     self.m_status = wx.TextCtrl(self, wx.ID_ANY, u"Init",
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.TE_READONLY)
     self.m_status.SetFont(
         wx.Font(wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_TELETYPE,
                 wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False,
                 wx.EmptyString))
     self.m_status.SetMaxLength(maxlen)
     self.m_status.SetInitialSize(
         self.m_status.GetSizeFromTextSize(
             self.m_status.GetTextExtent("A" * maxlen)))
     wSizer101.Add(self.m_status, 0, wx.ALL, 5)
     self.m_cylmsg = wx.StaticText(self, wx.ID_ANY, u"Cylinder",
                                   wx.DefaultPosition, wx.DefaultSize, 0)
     self.m_cylmsg.Wrap(-1)
     wSizer101.Add(self.m_cylmsg, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
     maxlen = 2
     self.m_cyl = wx.TextCtrl(self, wx.ID_ANY, u"00", wx.DefaultPosition,
                              wx.DefaultSize, wx.TE_READONLY)
     self.m_cyl.SetMaxLength(2)
     self.m_cyl.SetFont(
         wx.Font(wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_TELETYPE,
                 wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False,
                 wx.EmptyString))
     self.m_cyl.SetInitialSize(
         self.m_cyl.GetSizeFromTextSize(
             self.m_cyl.GetTextExtent("A" * maxlen)))
     wSizer101.Add(self.m_cyl, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.m_sidemsg = wx.StaticText(self, wx.ID_ANY, u"Side",
                                    wx.DefaultPosition, wx.DefaultSize, 0)
     self.m_sidemsg.Wrap(-1)
     wSizer101.Add(self.m_sidemsg, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     maxlen = 1
     self.m_side = wx.TextCtrl(self, wx.ID_ANY, u"0", wx.DefaultPosition,
                               wx.DefaultSize, wx.TE_READONLY)
     self.m_side.SetMaxLength(maxlen)
     self.m_side.SetFont(
         wx.Font(wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_TELETYPE,
                 wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False,
                 wx.EmptyString))
     self.m_side.SetInitialSize(
         self.m_side.GetSizeFromTextSize(
             self.m_side.GetTextExtent("A" * maxlen)))
     wSizer101.Add(self.m_side, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)
     self.m_timermsg = wx.StaticText(self, wx.ID_ANY, u"Time",
                                     wx.DefaultPosition, wx.DefaultSize, 0)
     self.m_timermsg.Wrap(-1)
     wSizer101.Add(self.m_timermsg, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
     self.m_timer = wx.TextCtrl(self, wx.ID_ANY, u"   0.0s",
                                wx.DefaultPosition, wx.DefaultSize,
                                wx.TE_READONLY)
     self.m_timer.SetFont(
         wx.Font(wx.NORMAL_FONT.GetPointSize(), wx.FONTFAMILY_TELETYPE,
                 wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False,
                 wx.EmptyString))
     maxlen = 7
     self.m_timer.SetMaxLength(maxlen)
     self.m_timer.SetInitialSize(
         self.m_timer.GetSizeFromTextSize(
             self.m_timer.GetTextExtent("A" * maxlen)))
     wSizer101.Add(self.m_timer, 0, wx.ALL, 5)
     bSizer1.Add(wSizer101, 0, wx.EXPAND, 5)
     self.SetSizer(bSizer1)
     self.Enablement(False)
     self.Layout()
     self.Centre(wx.BOTH)
     self.Bind(wx.EVT_CLOSE, self.onCloseSetup)
     return