Exemple #1
0
    def __init__(self, parent, config):
        super(MainFrame, self).__init__("DeepLabCut2.0 - Refinement ToolBox", parent)
        self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyPressed)

        ###################################################################################################################################################

        # Spliting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting!

        topSplitter = wx.SplitterWindow(self)
        vSplitter = wx.SplitterWindow(topSplitter)

        self.image_panel = ImagePanel(vSplitter, config, self.gui_size)
        self.choice_panel = ScrollPanel(vSplitter)
        # self.choice_panel.SetupScrolling(scroll_x=True, scroll_y=True, scrollToTop=False)
        # self.choice_panel.SetupScrolling(scroll_x=True, scrollToTop=False)
        vSplitter.SplitVertically(
            self.image_panel, self.choice_panel, sashPosition=self.gui_size[0] * 0.8
        )
        vSplitter.SetSashGravity(1)
        self.widget_panel = WidgetPanel(topSplitter)
        topSplitter.SplitHorizontally(
            vSplitter, self.widget_panel, sashPosition=self.gui_size[1] * 0.83
        )  # 0.9
        topSplitter.SetSashGravity(1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(topSplitter, 1, wx.EXPAND)
        self.SetSizer(sizer)

        ###################################################################################################################################################
        # Add Buttons to the WidgetPanel and bind them to their respective functions.

        widgetsizer = wx.WrapSizer(orient=wx.HORIZONTAL)
        self.load = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Load labels")
        widgetsizer.Add(self.load, 1, wx.ALL, 15)
        self.load.Bind(wx.EVT_BUTTON, self.browseDir)

        self.prev = wx.Button(self.widget_panel, id=wx.ID_ANY, label="<<Previous")
        widgetsizer.Add(self.prev, 1, wx.ALL, 15)
        self.prev.Bind(wx.EVT_BUTTON, self.prevImage)
        self.prev.Enable(False)

        self.next = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Next>>")
        widgetsizer.Add(self.next, 1, wx.ALL, 15)
        self.next.Bind(wx.EVT_BUTTON, self.nextImage)
        self.next.Enable(False)

        self.help = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Help")
        widgetsizer.Add(self.help, 1, wx.ALL, 15)
        self.help.Bind(wx.EVT_BUTTON, self.helpButton)
        self.help.Enable(True)

        self.zoom = wx.ToggleButton(self.widget_panel, label="Zoom")
        widgetsizer.Add(self.zoom, 1, wx.ALL, 15)
        self.zoom.Bind(wx.EVT_TOGGLEBUTTON, self.zoomButton)
        self.widget_panel.SetSizer(widgetsizer)
        self.zoom.Enable(False)

        self.home = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Home")
        widgetsizer.Add(self.home, 1, wx.ALL, 15)
        self.home.Bind(wx.EVT_BUTTON, self.homeButton)
        self.widget_panel.SetSizer(widgetsizer)
        self.home.Enable(False)

        self.pan = wx.ToggleButton(self.widget_panel, id=wx.ID_ANY, label="Pan")
        widgetsizer.Add(self.pan, 1, wx.ALL, 15)
        self.pan.Bind(wx.EVT_TOGGLEBUTTON, self.panButton)
        self.widget_panel.SetSizer(widgetsizer)
        self.pan.Enable(False)

        self.lock = wx.CheckBox(self.widget_panel, id=wx.ID_ANY, label="Lock View")
        widgetsizer.Add(self.lock, 1, wx.ALL, 15)
        self.lock.Bind(wx.EVT_CHECKBOX, self.lockChecked)
        self.widget_panel.SetSizer(widgetsizer)
        self.lock.Enable(False)

        self.save = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Save")
        widgetsizer.Add(self.save, 1, wx.ALL, 15)
        self.save.Bind(wx.EVT_BUTTON, self.saveDataSet)
        self.save.Enable(False)

        widgetsizer.AddStretchSpacer(15)
        self.quit = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Quit")
        widgetsizer.Add(self.quit, 1, wx.ALL, 15)
        self.quit.Bind(wx.EVT_BUTTON, self.quitButton)

        self.widget_panel.SetSizer(widgetsizer)
        self.widget_panel.SetSizerAndFit(widgetsizer)
        self.widget_panel.Layout()

        ###############################################################################################################################
        # Variable initialization
        self.currentDirectory = os.getcwd()
        self.index = []
        self.iter = []
        self.threshold = []
        self.file = 0
        self.updatedCoords = []
        self.dataFrame = None
        self.drs = []
        cfg = auxiliaryfunctions.read_config(config)
        self.humanscorer = cfg["scorer"]
        self.move2corner = cfg["move2corner"]
        self.center = cfg["corner2move2"]
        self.colormap = plt.get_cmap(cfg["colormap"])
        self.colormap = self.colormap.reversed()
        self.markerSize = cfg["dotsize"]
        self.alpha = cfg["alphavalue"]
        self.iterationindex = cfg["iteration"]
        self.project_path = cfg["project_path"]
        self.bodyparts = cfg["bodyparts"]
        self.threshold = 0.4
        self.img_size = (10, 6)  # (imgW, imgH)  # width, height in inches.
        self.preview = False
        self.view_locked = False
        # Workaround for MAC - xlim and ylim changed events seem to be triggered too often so need to make sure that the
        # xlim and ylim have actually changed before turning zoom off
        self.prezoom_xlim = []
        self.prezoom_ylim = []
Exemple #2
0
    def __init__(self, parent=None):
        self.translationDict = None

        if Config.language is None:
            Config.language = eg.config.language

        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "Language Editor",
                          pos=Config.position,
                          size=Config.size)
        self.menuBar = self.CreateMenuBar()
        self.CreateStatusBar()

        splitter = wx.SplitterWindow(self, -1, style=wx.SP_LIVE_UPDATE)

        imageList = wx.ImageList(16, 16)
        for pathName in (
                join(eg.corePluginDir, "EventGhost", "icons",
                     "DisableItem.png"),
                join(eg.corePluginDir, "EventGhost", "icons",
                     "EnableItem.png"),
                join(eg.imagesDir, "folder.png"),
                join(eg.imagesDir, "root.png"),
                join(eg.imagesDir, "new.png"),
        ):
            imageList.Add(
                wx.BitmapFromImage(wx.Image(pathName, wx.BITMAP_TYPE_PNG)))

        self.tree = tree = wx.TreeCtrl(splitter, -1, style=wx.TR_HAS_BUTTONS)
        tree.AssignImageList(imageList)
        self.rootId = tree.AddRoot("Language Strings", 3)
        tree.SetPyData(self.rootId, ["", None, None])

        eg.Init.ImportAll()
        eg.actionThread.Start()

        def LoadPlugins():
            for plugin in os.listdir(eg.corePluginDir):
                if not plugin.startswith("."):
                    try:
                        eg.pluginManager.OpenPlugin(plugin, plugin, ()).Close()
                    except eg.Exceptions.PluginLoadError:
                        pass

        eg.actionThread.CallWait(LoadPlugins)

        rightPanel = wx.Panel(splitter)
        self.disabledColour = rightPanel.GetBackgroundColour()

        languageNames = eg.Translation.languageNames
        self.langKeys = sorted(languageNames, key=languageNames.get)
        self.langNames = [languageNames[k] for k in self.langKeys]

        self.currentValueCtrl = wx.TextCtrl(rightPanel,
                                            style=wx.TE_MULTILINE
                                            | wx.TE_READONLY)
        self.enabledColour = self.currentValueCtrl.GetBackgroundColour()
        self.currentValueCtrl.SetBackgroundColour(self.disabledColour)
        self.currentValueCtrl.SetEditable(False)

        self.newValueCtrl = wx.TextCtrl(rightPanel, style=wx.TE_MULTILINE)

        staticBoxSizer1 = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label="Original Text"), wx.VERTICAL)
        staticBoxSizer1.Add(self.currentValueCtrl, 1, wx.EXPAND)
        staticBoxSizer2 = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label="Translated Text"), wx.VERTICAL)
        staticBoxSizer2.Add(self.newValueCtrl, 1, wx.EXPAND)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(staticBoxSizer1, 1, wx.EXPAND | wx.ALL, 5)
        sizer.Add((5, 5))
        sizer.Add(staticBoxSizer2, 1, wx.EXPAND | wx.ALL, 5)
        rightPanel.SetSizer(sizer)

        splitter.SplitVertically(tree, rightPanel)
        splitter.SetMinimumPaneSize(120)
        splitter.SetSashGravity(0.0)
        splitter.SetSashPosition(Config.splitPosition)  #width + 20)

        self.isDirty = False

        self.newValueCtrl.Bind(wx.EVT_TEXT, self.OnTextChange)
        tree.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnSelectionChanging)
        tree.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnItemCollapsing)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_MENU_OPEN, self.OnValidateMenus)

        self.LoadLanguage(Config.language)
        self.Show()
Exemple #3
0
 def test_splitterDefaultCtor(self):
     sw = wx.SplitterWindow()
     sw.Create(self.frame)
Exemple #4
0
    def __init__(self,
                 parent,
                 filename=None,
                 read_ok_cb=None,
                 size=(725, 450),
                 _larch=None):
        self.parent = parent
        self.filename = filename
        self.larch = _larch
        self.read_ok_cb = read_ok_cb

        self.colors = GUIColors()

        wx.Frame.__init__(self, parent, -1, size=size, style=FRAMESTYLE)
        splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE)
        splitter.SetMinimumPaneSize(200)

        leftpanel = wx.Panel(splitter)
        ltop = wx.Panel(leftpanel)

        sel_none = Button(ltop,
                          'Select None',
                          size=(100, 30),
                          action=self.onSelNone)
        sel_all = Button(ltop,
                         'Select All',
                         size=(100, 30),
                         action=self.onSelAll)
        sel_imp = Button(ltop,
                         'Import Selected Groups',
                         size=(200, 30),
                         action=self.onOK)

        self.select_imported = sel_imp
        self.grouplist = FileCheckList(leftpanel,
                                       select_action=self.onShowGroup)

        tsizer = wx.GridBagSizer(2, 2)
        tsizer.Add(sel_all, (0, 0), (1, 1), LEFT, 0)
        tsizer.Add(sel_none, (0, 1), (1, 1), LEFT, 0)
        tsizer.Add(sel_imp, (1, 0), (1, 2), LEFT, 0)

        pack(ltop, tsizer)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(ltop, 0, LEFT | wx.GROW, 1)
        sizer.Add(self.grouplist, 1, LEFT | wx.GROW | wx.ALL, 1)
        pack(leftpanel, sizer)

        # right hand side
        rightpanel = wx.Panel(splitter)

        self.SetTitle("Reading Athena Project '%s'" % self.filename)
        self.title = SimpleText(rightpanel,
                                self.filename,
                                font=Font(13),
                                colour=self.colors.title,
                                style=LEFT)

        self.plotpanel = PlotPanel(rightpanel, messenger=self.plot_messages)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.title, 0, LEFT, 2)
        sizer.Add(self.plotpanel, 0, LEFT, 2)
        pack(rightpanel, sizer)

        splitter.SplitVertically(leftpanel, rightpanel, 1)

        self.statusbar = self.CreateStatusBar(2, 0)
        self.statusbar.SetStatusWidths([-3, -1])
        statusbar_fields = [self.filename, ""]
        for i in range(len(statusbar_fields)):
            self.statusbar.SetStatusText(statusbar_fields[i], i)

        self.a_project = read_athena(self.filename,
                                     do_bkg=False,
                                     do_fft=False,
                                     _larch=_larch)
        self.allgroups = []
        for item in self.a_project._athena_groups:
            if not item.startswith('_athena_'):
                self.allgroups.append(item)
                self.grouplist.Append(item)
        self.Show()
        self.Raise()
    def _init_ctrls(self, prnt):
        # generated method, don't edit

        wx.Panel.__init__(self,
                          id=wxID_PNLSERIESSELECTOR,
                          name=u'pnlSeriesSelector',
                          parent=prnt,
                          pos=wx.Point(511, 413),
                          size=wx.Size(935, 270),
                          style=wx.TAB_TRAVERSAL)
        self.SetClientSize(wx.Size(919, 232))
        self.Enable(True)

        ## Radio panel
        self.pnlRadio = wx.Panel(id=wxID_PNLRADIO,
                                 name='pnlRadio',
                                 parent=self,
                                 pos=wx.Point(3, 3),
                                 size=wx.Size(919, 20),
                                 style=wx.TAB_TRAVERSAL)

        self.rbAll = wx.RadioButton(id=wxID_FRAME1RBALL,
                                    label=u'All',
                                    name=u'rbAll',
                                    parent=self.pnlRadio,
                                    pos=wx.Point(0, 0),
                                    size=wx.Size(81, 20),
                                    style=0)
        self.rbAll.SetValue(True)
        self.rbAll.Bind(wx.EVT_RADIOBUTTON,
                        self.OnRbAllRadiobutton,
                        id=wxID_FRAME1RBALL)

        self.rbSimple = wx.RadioButton(id=wxID_FRAME1RBSIMPLE,
                                       label=u'Simple Filter',
                                       name=u'rbSimple',
                                       parent=self.pnlRadio,
                                       pos=wx.Point(81, 0),
                                       size=wx.Size(112, 20),
                                       style=0)
        self.rbSimple.Bind(wx.EVT_RADIOBUTTON,
                           self.OnRbSimpleRadiobutton,
                           id=wxID_FRAME1RBSIMPLE)

        self.rbAdvanced = wx.RadioButton(id=wxID_FRAME1RBADVANCED,
                                         label=u'Advanced Filter',
                                         name=u'rbAdvanced',
                                         parent=self.pnlRadio,
                                         pos=wx.Point(193, 0),
                                         size=wx.Size(104, 20),
                                         style=0)
        self.rbAdvanced.Bind(wx.EVT_RADIOBUTTON,
                             self.OnRbAdvancedRadiobutton,
                             id=wxID_FRAME1RBADVANCED)
        # self.rbAdvanced.Enable(False)

        ## Splitter panel
        self.pnlSplitter = wx.Panel(id=wxID_PNLSPLITTER,
                                    name='pnlSplitter',
                                    parent=self,
                                    pos=wx.Point(3, 3),
                                    size=wx.Size(919, 349),
                                    style=wx.TAB_TRAVERSAL)

        self.splitter = wx.SplitterWindow(id=wxID_FRAME1SPLITTER,
                                          name=u'splitter',
                                          parent=self.pnlSplitter,
                                          pos=wx.Point(0, 0),
                                          size=wx.Size(604, 137),
                                          style=wx.NO_BORDER)
        self.splitter.SetMinSize(wx.Size(-1, -1))

        ## panel for simple filter(top of splitter)
        self.pnlSimple = wx.Panel(id=wxID_PNLSIMPLE,
                                  name='panel3',
                                  parent=self.splitter,
                                  pos=wx.Point(0, 0),
                                  size=wx.Size(919, 300),
                                  style=wx.TAB_TRAVERSAL)

        ## Site Panel
        self.panel1 = wx.Panel(id=wxID_PNLSERIESSELECTORPANEL1,
                               name='panel1',
                               parent=self.pnlSimple,
                               pos=wx.Point(3, 3),
                               size=wx.Size(919, 30),
                               style=wx.TAB_TRAVERSAL)

        self.cbSites = wx.ComboBox(choices=[],
                                   id=wxID_PNLSERIESSELECTORCBSITES,
                                   name=u'cbSites',
                                   parent=self.panel1,
                                   pos=wx.Point(123, 3),
                                   size=wx.Size(787, 21),
                                   style=0,
                                   value=u'')
        self.cbSites.SetLabel(u'')
        self.cbSites.Bind(wx.EVT_COMBOBOX,
                          self.OnCbSitesCombobox,
                          id=wxID_PNLSERIESSELECTORCBSITES)

        self.checkSite = wx.CheckBox(id=wxID_PNLSERIESSELECTORCHECKSITE,
                                     label=u'',
                                     name=u'checkSite',
                                     parent=self.panel1,
                                     pos=wx.Point(3, 3),
                                     size=wx.Size(21, 21),
                                     style=0)
        self.checkSite.SetValue(True)
        self.checkSite.Bind(wx.EVT_CHECKBOX,
                            self.OnCheck,
                            id=wxID_PNLSERIESSELECTORCHECKSITE)

        self.lblSite = wx.StaticText(id=wxID_PNLSERIESSELECTORLBLSITE,
                                     label=u'Site',
                                     name=u'lblSite',
                                     parent=self.panel1,
                                     pos=wx.Point(30, 3),
                                     size=wx.Size(87, 13),
                                     style=0)
        self.lblSite.SetToolTipString(u'staticText1')

        ### Variable Panel
        self.panel2 = wx.Panel(id=wxID_PNLSERIESSELECTORPANEL2,
                               name='panel2',
                               parent=self.pnlSimple,
                               pos=wx.Point(3, 39),
                               size=wx.Size(919, 30),
                               style=wx.TAB_TRAVERSAL)

        self.lblVariable = wx.StaticText(id=wxID_PNLSERIESSELECTORLBLVARIABLE,
                                         label=u'Variable',
                                         name=u'lblVariable',
                                         parent=self.panel2,
                                         pos=wx.Point(30, 3),
                                         size=wx.Size(87, 13),
                                         style=0)

        self.checkVariable = wx.CheckBox(
            id=wxID_PNLSERIESSELECTORCHECKVARIABLE,
            label=u'',
            name=u'checkVariable',
            parent=self.panel2,
            pos=wx.Point(3, 3),
            size=wx.Size(21, 21),
            style=0)
        self.checkVariable.Bind(wx.EVT_CHECKBOX,
                                self.OnCheck,
                                id=wxID_PNLSERIESSELECTORCHECKVARIABLE)

        self.cbVariables = wx.ComboBox(choices=[],
                                       id=wxID_PNLSERIESSELECTORCBVARIABLES,
                                       name=u'cbVariables',
                                       parent=self.panel2,
                                       pos=wx.Point(123, 3),
                                       size=wx.Size(123, 3),
                                       style=0,
                                       value='comboBox4')
        self.cbVariables.SetLabel(u'')
        self.cbVariables.Enable(False)
        self.cbVariables.Bind(wx.EVT_COMBOBOX,
                              self.OnCbVariablesCombobox,
                              id=wxID_PNLSERIESSELECTORCBVARIABLES)

        self.tableSeries = clsULC(
            id=wxID_PNLSERIESSELECTORtableSeries,
            name=u'tableSeries',
            parent=self.splitter,
            pos=wx.Point(5, 5),
            size=wx.Size(903, 108),
            agwStyle=ULC.ULC_REPORT | ULC.ULC_HRULES | ULC.ULC_VRULES
            | ULC.ULC_HAS_VARIABLE_ROW_HEIGHT | ULC.ULC_SINGLE_SEL)
        self.splitter.Initialize(self.tableSeries)
        self.pnlSimple.Show(False)
        # self.splitter.SplitHorizontally(self.pnlSimple, self.tableSeries, 1)

        self.tableSeries.Bind(ULC.EVT_LIST_ITEM_CHECKED,
                              self.OntableSeriesListItemSelected,
                              id=wxID_PNLSERIESSELECTORtableSeries)

        self.tableSeries.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK,
                              self.OnTableRightDown,
                              id=wxID_PNLSERIESSELECTORtableSeries)

        Publisher.subscribe(self.OnEditButton, ("selectEdit"))
        self._init_sizers()
Exemple #6
0
    def __init__(self, parent, xmlstr=''):
        wx.Panel.__init__(self, parent, -1)

        self.xml = xmlstr
        self.lastXPath = ''

        self.splitter = wx.SplitterWindow(self, style=wx.BORDER_NONE)
        self.splitter2 = wx.SplitterWindow(self.splitter, style=wx.BORDER_NONE)

        leftPanel = wx.Panel(self.splitter,
                             style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN)

        self.tree = XMLTree(leftPanel)
        self.search = wx.SearchCtrl(leftPanel, -1, style=wx.TE_PROCESS_ENTER)
        self.search.ShowSearchButton(True)
        self.search.ShowCancelButton(True)
        menu = wx.Menu()
        self.textMenuItem = menu.AppendRadioItem(-1, "Tag/Text")
        self.xpathMenuItem = menu.AppendRadioItem(-1, "XPath")
        self.search.SetMenu(menu)

        self.attr = AttributeList(self.splitter2)
        self.text = wx.TextCtrl(self.splitter2, style=wx.TE_MULTILINE)
        self.text.SetEditable(False)

        self.splitter.SetMinimumPaneSize(120)
        self.splitter.SplitVertically(leftPanel, self.splitter2, 180)

        self.splitter2.SetMinimumPaneSize(160)
        self.splitter2.SplitHorizontally(self.attr, self.text, 180)

        bottomPanel = wx.Panel(self, style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN)

        xpathLabel = wx.StaticText(bottomPanel, -1, "XPath")
        self.xpath = wx.TextCtrl(bottomPanel)
        #		self.xpath.SetEditable(False)
        self.filter = wx.Button(bottomPanel, -1, 'Filter')
        self.copy = wx.Button(bottomPanel, -1, 'Copy To Clipboard')

        leftBox = wx.BoxSizer(wx.VERTICAL)
        leftBox.Add(self.tree, 1, wx.EXPAND)
        leftBox.Add(wx.StaticText(leftPanel, label="Search in tree"), 0,
                    wx.TOP | wx.LEFT, 5)
        leftBox.Add(self.search, 0, wx.EXPAND | wx.ALL, 5)
        leftPanel.SetSizer(leftBox)

        bottomSizer = wx.FlexGridSizer(cols=4, hgap=4, vgap=10)
        bottomSizer.AddGrowableCol(1)
        bottomSizer.Add(xpathLabel, 1, wx.ALIGN_CENTER_VERTICAL)
        bottomSizer.Add(self.xpath, 2, wx.EXPAND)
        bottomSizer.Add(self.filter, 3, wx.ALIGN_CENTER_VERTICAL)
        bottomSizer.Add(self.copy, 4, wx.ALIGN_CENTER_VERTICAL)
        bottomPanel.SetSizer(bottomSizer)

        box = wx.BoxSizer(wx.VERTICAL)
        box.Add(self.splitter, 1, wx.EXPAND, 10)
        box.Add(bottomPanel, 0, wx.EXPAND, 10)
        self.SetSizer(box)

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged, self.tree)

        #		self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
        self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
        self.Bind(wx.EVT_TEXT_ENTER, self.OnSearch, self.search)
        self.Bind(wx.EVT_TEXT, self.OnIncrSearch, self.search)

        self.attr.UpdateXPath = self.UpdateXPath
        self.Bind(wx.EVT_BUTTON, self.OnFilter, self.filter)
        self.Bind(wx.EVT_BUTTON, self.CopyToClipboard, self.copy)

        if xmlstr.strip():
            self.InitXML()
    def __init__(
        self, parent, config, video, shuffle, Dataframe, savelabeled, multianimal
    ):
        super(MainFrame, self).__init__(
            "DeepLabCut2.0 - Manual Outlier Frame Extraction", parent,
        )

        ###################################################################################################################################################
        # Spliting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting!
        # topSplitter = wx.SplitterWindow(self)
        #
        # self.image_panel = ImagePanel(topSplitter, config,video,shuffle,Dataframe,self.gui_size)
        # self.widget_panel = WidgetPanel(topSplitter)
        #
        # topSplitter.SplitHorizontally(self.image_panel, self.widget_panel,sashPosition=self.gui_size[1]*0.83)#0.9
        # topSplitter.SetSashGravity(1)
        # sizer = wx.BoxSizer(wx.VERTICAL)
        # sizer.Add(topSplitter, 1, wx.EXPAND)
        # self.SetSizer(sizer)

        # Spliting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting!

        topSplitter = wx.SplitterWindow(self)
        vSplitter = wx.SplitterWindow(topSplitter)

        self.image_panel = ImagePanel(vSplitter, self.gui_size)
        self.choice_panel = ScrollPanel(vSplitter)

        vSplitter.SplitVertically(
            self.image_panel, self.choice_panel, sashPosition=self.gui_size[0] * 0.8
        )
        vSplitter.SetSashGravity(1)
        self.widget_panel = WidgetPanel(topSplitter)
        topSplitter.SplitHorizontally(
            vSplitter, self.widget_panel, sashPosition=self.gui_size[1] * 0.83
        )  # 0.9
        topSplitter.SetSashGravity(1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(topSplitter, 1, wx.EXPAND)
        self.SetSizer(sizer)

        ###################################################################################################################################################
        # Add Buttons to the WidgetPanel and bind them to their respective functions.

        widgetsizer = wx.WrapSizer(orient=wx.HORIZONTAL)

        self.load_button_sizer = wx.BoxSizer(wx.VERTICAL)
        self.help_button_sizer = wx.BoxSizer(wx.VERTICAL)

        self.help = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Help")
        self.help_button_sizer.Add(self.help, 1, wx.ALL, 15)
        #        widgetsizer.Add(self.help , 1, wx.ALL, 15)
        self.help.Bind(wx.EVT_BUTTON, self.helpButton)

        widgetsizer.Add(self.help_button_sizer, 1, wx.ALL, 0)

        self.grab = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Grab Frames")
        widgetsizer.Add(self.grab, 1, wx.ALL, 15)
        self.grab.Bind(wx.EVT_BUTTON, self.grabFrame)
        self.grab.Enable(True)

        widgetsizer.AddStretchSpacer(5)
        self.slider = wx.Slider(
            self.widget_panel,
            id=wx.ID_ANY,
            value=0,
            minValue=0,
            maxValue=1,
            size=(200, -1),
            style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS,
        )
        widgetsizer.Add(self.slider, 1, wx.ALL, 5)
        self.slider.Bind(wx.EVT_SLIDER, self.OnSliderScroll)

        widgetsizer.AddStretchSpacer(5)
        self.start_frames_sizer = wx.BoxSizer(wx.VERTICAL)
        self.end_frames_sizer = wx.BoxSizer(wx.VERTICAL)

        self.start_frames_sizer.AddSpacer(15)
        #        self.startFrame = wx.SpinCtrl(self.widget_panel, value='0', size=(100, -1), min=0, max=120)
        self.startFrame = wx.SpinCtrl(
            self.widget_panel, value="0", size=(100, -1)
        )  # ,style=wx.SP_VERTICAL)
        self.startFrame.Enable(False)
        self.start_frames_sizer.Add(self.startFrame, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        start_text = wx.StaticText(self.widget_panel, label="Start Frame Index")
        self.start_frames_sizer.Add(start_text, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        self.checkBox = wx.CheckBox(
            self.widget_panel, id=wx.ID_ANY, label="Range of frames"
        )
        self.checkBox.Bind(wx.EVT_CHECKBOX, self.activate_frame_range)
        self.start_frames_sizer.Add(self.checkBox, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        #
        self.end_frames_sizer.AddSpacer(15)
        self.endFrame = wx.SpinCtrl(
            self.widget_panel, value="1", size=(160, -1)
        )  # , min=1, max=120)
        self.endFrame.Enable(False)
        self.end_frames_sizer.Add(self.endFrame, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        end_text = wx.StaticText(self.widget_panel, label="Number of Frames")
        self.end_frames_sizer.Add(end_text, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        self.updateFrame = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Update")
        self.end_frames_sizer.Add(self.updateFrame, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        self.updateFrame.Bind(wx.EVT_BUTTON, self.updateSlider)
        self.updateFrame.Enable(False)

        widgetsizer.Add(self.start_frames_sizer, 1, wx.ALL, 0)
        widgetsizer.AddStretchSpacer(5)
        widgetsizer.Add(self.end_frames_sizer, 1, wx.ALL, 0)
        widgetsizer.AddStretchSpacer(15)

        self.quit = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Quit")
        widgetsizer.Add(self.quit, 1, wx.ALL, 15)
        self.quit.Bind(wx.EVT_BUTTON, self.quitButton)
        self.quit.Enable(True)

        self.widget_panel.SetSizer(widgetsizer)
        self.widget_panel.SetSizerAndFit(widgetsizer)

        # Variables initialization
        self.numberFrames = 0
        self.currFrame = 0
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.drs = []
        self.extract_range_frame = False
        self.firstFrame = 0
        self.Colorscheme = []

        # Read confing file
        self.cfg = auxiliaryfunctions.read_config(config)
        self.Task = self.cfg["Task"]
        self.start = self.cfg["start"]
        self.stop = self.cfg["stop"]
        self.date = self.cfg["date"]
        self.trainFraction = self.cfg["TrainingFraction"]
        self.trainFraction = self.trainFraction[0]
        self.videos = self.cfg["video_sets"].keys()
        self.bodyparts = self.cfg["bodyparts"]
        self.colormap = plt.get_cmap(self.cfg["colormap"])
        self.colormap = self.colormap.reversed()
        self.markerSize = self.cfg["dotsize"]
        self.alpha = self.cfg["alphavalue"]
        self.iterationindex = self.cfg["iteration"]
        self.cropping = self.cfg["cropping"]
        self.video_names = [Path(i).stem for i in self.videos]
        self.config_path = Path(config)
        self.video_source = Path(video).resolve()
        self.shuffle = shuffle
        self.Dataframe = Dataframe
        self.savelabeled = savelabeled
        self.multianimal = multianimal
        if self.multianimal:
            from deeplabcut.utils import auxfun_multianimal

            (
                self.individual_names,
                self.uniquebodyparts,
                self.multianimalbodyparts,
            ) = auxfun_multianimal.extractindividualsandbodyparts(self.cfg)
            self.choiceBox, self.visualization_rdb = self.choice_panel.addRadioButtons()
            self.Colorscheme = visualization.get_cmap(
                len(self.individual_names), self.cfg["colormap"]
            )
            self.visualization_rdb.Bind(wx.EVT_RADIOBOX, self.clear_plot)
        # Read the video file
        self.vid = VideoWriter(str(self.video_source))
        if self.cropping:
            self.vid.set_bbox(
                self.cfg["x1"], self.cfg["x2"], self.cfg["y1"], self.cfg["y2"]
            )
        self.filename = Path(self.video_source).name
        self.numberFrames = len(self.vid)
        self.strwidth = int(np.ceil(np.log10(self.numberFrames)))
        # Set the values of slider and range of frames
        self.startFrame.SetMax(self.numberFrames - 1)
        self.slider.SetMax(self.numberFrames - 1)
        self.endFrame.SetMax(self.numberFrames - 1)
        self.startFrame.Bind(wx.EVT_SPINCTRL, self.updateSlider)  # wx.EVT_SPIN
        # Set the status bar
        self.statusbar.SetStatusText("Working on video: {}".format(self.filename))
        # Adding the video file to the config file.
        if self.vid.name not in self.video_names:
            add.add_new_videos(self.config_path, [self.video_source])

        self.update()
        self.plot_labels()
        self.widget_panel.Layout()
Exemple #8
0
    def createSplitters(self):
        # Create the splitter window.
        splitter = wx.SplitterWindow(self)
        splitter.SetMinimumPaneSize(1)

        font = wx.Font(16, wx.SWISS, wx.NORMAL, wx.NORMAL)
        if sys.platform == "darwin":
            fontLines = wx.Font(FACE_SIZE - 1, wx.DEFAULT, wx.NORMAL,
                                wx.NORMAL, False, FACE3)
        else:
            fontLines = wx.Font(FACE_SIZE, wx.DEFAULT, wx.NORMAL, wx.NORMAL,
                                False, FACE3)

        def createTextPanel(self, splitter, scrollCallback, filename):
            swindow = wx.ScrolledWindow(splitter)
            swindow.SetScrollbars(20, 20, 55, 40)
            swindow.Scroll(0, 0)
            swindow.Bind(wx.EVT_SCROLLWIN, scrollCallback)

            vbox = wx.BoxSizer(wx.VERTICAL)
            hbox = wx.BoxSizer(wx.HORIZONTAL)
            swindow.SetSizer(vbox)
            lbl = wx.StaticText(swindow, -1, filename, (-1, -1))
            linesLbl = wx.StaticText(swindow,
                                     -1,
                                     "1", (-1, -1),
                                     style=wx.ALIGN_RIGHT)
            linesLbl.SetFont(fontLines)
            lbl.SetFont(font)
            vbox.Add(lbl, 0, flag=wx.CENTER)
            view = DiffSTC(swindow, -1)
            vbox.Add(hbox, 1, flag=wx.EXPAND)
            hbox.Add(linesLbl, 0)
            hbox.Add(view, 1, flag=wx.EXPAND)
            return lbl, linesLbl, view, swindow

        self.rightLbl, self.rightLinesLbl, self.rightView, self.rightSWindow = createTextPanel(
            self, splitter, self.OnScrollRight, self.rightFileName)
        self.leftLbl, self.leftLinesLbl, self.leftView, self.leftSWindow = createTextPanel(
            self, splitter, self.OnScrollLeft, self.leftFileName)

        #create text
        self.populateText()
        self.rightViewOrig = self.rightView.GetValue()

        splitter.SplitVertically(self.leftSWindow, self.rightSWindow)
        splitter.SetSashPosition(250, True)
        self.splitter = splitter

        self.leftView.Bind(wx.EVT_SCROLLWIN, self.OnScrollLeft)
        self.last_left_pos = self.leftView.GetScrollPos(1)
        self.last_right_pos = self.rightView.GetScrollPos(1)
        self.leftView.SetUseVerticalScrollBar(False)
        self.rightView.SetUseVerticalScrollBar(False)
        self.leftView.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel)
        self.rightView.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel)
        self.leftView.SetReadOnly(True)

        self.leftView.Bind(wx.EVT_LEFT_UP, self.OnMouseLeft)
        self.rightView.Bind(wx.EVT_LEFT_UP, self.OnMouseRight)

        self.rightView.Bind(wx.EVT_KEY_UP, self.OnKey)
        self.rightView.Bind(wx.EVT_KEY_DOWN, self.OnKey)
Exemple #9
0
    def loadUI(self):
        self.sp = wx.SplitterWindow(self)
        self.p1 = wx.Panel(self.sp, style=wx.SUNKEN_BORDER)
        self.p2 = wx.Panel(self.sp, style=wx.SUNKEN_BORDER)
        self.sp.SplitVertically(self.p1, self.p2,
                                650)  #split the window into two panels

        # p1 paint panel
        self.paint = paintpanel(self.p1)

        # p2 control panel
        self.label1 = wx.StaticText(self.p2,
                                    -1,
                                    label="Window Size:",
                                    pos=(10, 10))
        self.slider1 = wx.Slider(self.p2,
                                 wx.SL_HORIZONTAL,
                                 pos=(10, 40),
                                 minValue=1,
                                 maxValue=6)
        self.label2 = wx.StaticText(self.p2,
                                    label=str(self.slider1.GetValue()),
                                    pos=(90, 10))

        self.label3 = wx.StaticText(self.p2, -1, label="RTT:", pos=(10, 70))
        self.slider2 = wx.Slider(self.p2,
                                 wx.SL_HORIZONTAL,
                                 pos=(10, 100),
                                 minValue=1,
                                 maxValue=20)
        self.label4 = wx.StaticText(self.p2,
                                    label=str(self.slider2.GetValue()),
                                    pos=(90, 70))

        self.label5 = wx.StaticText(self.p2,
                                    -1,
                                    label="Animation Frame:",
                                    pos=(10, 130))
        self.slider3 = wx.Slider(self.p2,
                                 wx.SL_HORIZONTAL,
                                 pos=(10, 160),
                                 minValue=100,
                                 maxValue=1000)
        self.label6 = wx.StaticText(self.p2,
                                    label=str(self.slider3.GetValue()),
                                    pos=(120, 130))

        self.label7 = wx.StaticText(self.p2,
                                    -1,
                                    label="timeout:",
                                    pos=(10, 190))
        self.slider4 = wx.Slider(self.p2,
                                 wx.SL_HORIZONTAL,
                                 pos=(10, 220),
                                 minValue=1,
                                 maxValue=50)
        self.label8 = wx.StaticText(self.p2,
                                    label=str(self.slider2.GetValue()),
                                    pos=(90, 190))

        self.startbutton = wx.Button(self.p2, label="Start", pos=(30, 260))
        # self.stopbutton=wx.Button(self.p2,label="Stop",pos=(30,220))

        self.slider1.Bind(wx.EVT_SCROLL, self.onSliderChange1)
        self.slider2.Bind(wx.EVT_SCROLL, self.onSliderChange2)
        self.slider3.Bind(wx.EVT_SCROLL, self.onSliderChange3)
        self.slider4.Bind(wx.EVT_SCROLL, self.onSliderChange4)

        self.startbutton.Bind(wx.EVT_BUTTON, self.onClickConfirm)
    def __init__(self, *args, **kwds):
        # begin wxGlade: PAIMEIfilefuzz.__init__
        kwds["style"] = wx.TAB_TRAVERSAL
        wx.Panel.__init__(self, *args, **kwds)

        self.list_book = kwds["parent"]  # handle to list book.
        self.pydbg = copy.copy(
            self.list_book.top.pydbg)  # handle to top most frame.

        self.main_splitter = wx.SplitterWindow(self,
                                               -1,
                                               style=wx.SP_3D | wx.SP_BORDER)

        self.log_window_pane = wx.Panel(self.main_splitter, -1)
        self.main_window_pane = wx.Panel(self.main_splitter, -1)

        self.setup_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                  "Setup")
        self.setup_right_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                  "Byte Modifications")

        self.file_inspector_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                     "File Inspector")

        self.progress_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                     "Progress")
        self.statistics_sizer_staticbox = wx.StaticBox(self.main_window_pane,
                                                       -1, "Statistics")
        self.fuzz_sizer_staticbox = wx.StaticBox(self.main_window_pane, -1,
                                                 "Fuzz")

        self.program_name_label = wx.StaticText(self.main_window_pane, -1,
                                                "Program Name")
        self.program_name_control = filebrowse.FileBrowseButton(
            self.main_window_pane, -1, size=(500, -1), labelText="")

        self.source_name_label = wx.StaticText(self.main_window_pane, -1,
                                               "Source File Name")
        self.source_name_control = filebrowse.FileBrowseButton(
            self.main_window_pane, -1, size=(500, -1), labelText="")

        self.destination_label = wx.StaticText(self.main_window_pane, -1,
                                               "Destination Directory")
        self.destination_control = filebrowse.DirBrowseButton(
            self.main_window_pane, -1, size=(500, -1), labelText="")

        self.hex_label = wx.StaticText(self.main_window_pane, -1, "Hex Bytes")
        self.hex_control = wx.TextCtrl(self.main_window_pane, -1, "")

        self.start_label = wx.StaticText(self.main_window_pane, -1,
                                         "Range Start")
        self.start_control = wx.TextCtrl(self.main_window_pane, -1, "")
        self.start_control.SetMaxLength(7)

        self.end_label = wx.StaticText(self.main_window_pane, -1, "Range End")
        self.end_control = wx.TextCtrl(self.main_window_pane, -1, "")
        self.end_control.SetMaxLength(7)

        self.timeout_label = wx.StaticText(self.main_window_pane, -1,
                                           "Timeout (secs)")
        self.timer_control = wx.TextCtrl(self.main_window_pane, -1, "")
        self.timer_control.SetMaxLength(7)

        self.file_view_control = wx.TextCtrl(self.main_window_pane,
                                             -1,
                                             "",
                                             style=wx.TE_MULTILINE
                                             | wx.TE_READONLY | wx.TE_RICH2)

        self.file_list_box_control = wx.ListBox(self.main_window_pane,
                                                -1,
                                                choices=[],
                                                style=wx.LB_SINGLE)
        self.file_list_refresh_button = wx.Button(self.main_window_pane, -1,
                                                  "Refresh List")

        self.generate_button_control = wx.Button(self.main_window_pane, -1,
                                                 "Generate")
        self.run_button_control = wx.Button(self.main_window_pane, -1, "Run")
        self.stop_button_control = wx.Button(self.main_window_pane, -1, "Stop")

        self.stat_crashes_label = wx.StaticText(self.main_window_pane, -1,
                                                "# Crashes:")
        self.stat_crashes = wx.StaticText(self.main_window_pane,
                                          -1,
                                          "0 / 0%",
                                          style=wx.ALIGN_RIGHT)
        self.stat_num_read_label = wx.StaticText(self.main_window_pane, -1,
                                                 "# Read Violations:")
        self.stat_num_read = wx.StaticText(self.main_window_pane,
                                           -1,
                                           "0 / 0%",
                                           style=wx.ALIGN_RIGHT)
        self.stat_num_write_label = wx.StaticText(self.main_window_pane, -1,
                                                  "# Write Violations:")
        self.stat_num_write = wx.StaticText(self.main_window_pane,
                                            -1,
                                            "0 / 0%",
                                            style=wx.ALIGN_RIGHT)
        self.stat_running_time_label = wx.StaticText(self.main_window_pane, -1,
                                                     "Running Time:")
        self.stat_running_time = wx.StaticText(self.main_window_pane,
                                               -1,
                                               "00:00:00",
                                               style=wx.ALIGN_RIGHT)
        self.stat_end_eta_label = wx.StaticText(self.main_window_pane, -1,
                                                "Estimated Completion:")
        self.stat_end_eta = wx.StaticText(self.main_window_pane,
                                          -1,
                                          "00:00:00",
                                          style=wx.ALIGN_RIGHT)
        self.stat_last_violaton_label = wx.StaticText(
            self.main_window_pane, -1, "Last Violation Address:")
        self.stat_last_violation = wx.StaticText(self.main_window_pane,
                                                 -1,
                                                 "N/A",
                                                 style=wx.ALIGN_RIGHT)

        self.progress_text_label = wx.StaticText(self.main_window_pane, -1,
                                                 "File 0 / 0")
        self.progress_gauge_control = wx.Gauge(self.main_window_pane,
                                               -1,
                                               100,
                                               style=wx.GA_HORIZONTAL
                                               | wx.GA_SMOOTH)

        self.log = wx.TextCtrl(self.log_window_pane,
                               -1,
                               "",
                               style=wx.TE_MULTILINE | wx.TE_READONLY
                               | wx.TE_LINEWRAP)

        self.__set_properties()
        self.__do_layout()

        #self.Bind(wx.EVT_BUTTON, self.OnHistory, self.history_button_control)
        #self.Bind(wx.EVT_BUTTON, self.OnSave, self.save_button_control)
        #self.Bind(wx.EVT_BUTTON, self.OnLoad, self.Load)
        self.Bind(wx.EVT_LISTBOX, self.OnFileList, self.file_list_box_control)
        self.Bind(wx.EVT_BUTTON, self.OnRefresh, self.file_list_refresh_button)
        self.Bind(wx.EVT_BUTTON, self.OnGenerate, self.generate_button_control)
        self.Bind(wx.EVT_BUTTON, self.OnRun, self.run_button_control)
        self.Bind(wx.EVT_BUTTON, self.OnStop, self.stop_button_control)

        # Thread events
        self.Bind(EVT_THREAD_UPDATE, self.OnThreadUpdate)
        self.Bind(EVT_THREAD_LOG, self.OnThreadLog)
        self.Bind(EVT_THREAD_END, self.OnThreadEnd)

        self.msg("PaiMei File Fuzz")
        self.msg("Module by Cody Pierce\n")
    def __init__(self, *args, **kwds):
        # begin wxGlade: All_Widgets_Frame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((800, 417))

        # Menu Bar
        self.All_Widgets_menubar = wx.MenuBar()
        global mn_IDUnix
        mn_IDUnix = wx.NewId()
        global mn_IDWindows
        mn_IDWindows = wx.NewId()
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"),
                                _("Open an existing document"))
        wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"),
                                _("Close current document"))
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File"))
        wxglade_tmp_menu = wx.Menu()
        self.All_Widgets_menubar.mn_Unix = wxglade_tmp_menu.Append(
            mn_IDUnix, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.onSelectUnix, id=mn_IDUnix)
        self.All_Widgets_menubar.mn_Windows = wxglade_tmp_menu.Append(
            mn_IDWindows, _("Windows"), _("Use Windows line endings"),
            wx.ITEM_RADIO)
        self.Bind(wx.EVT_MENU, self.onSelectWindows, id=mn_IDWindows)
        wxglade_tmp_menu.AppendSeparator()
        self.All_Widgets_menubar.mn_RemoveTabs = wxglade_tmp_menu.Append(
            wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"),
            wx.ITEM_CHECK)
        self.Bind(wx.EVT_MENU,
                  self.onRemoveTabs,
                  id=self.All_Widgets_menubar.mn_RemoveTabs.GetId())
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit"))
        wxglade_tmp_menu = wx.Menu()
        wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"),
                                _("Show the application manual"))
        self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP)
        wxglade_tmp_menu.AppendSeparator()
        wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"),
                                _("Show the About dialog"))
        self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help"))
        self.SetMenuBar(self.All_Widgets_menubar)
        # Menu Bar end
        self.All_Widgets_statusbar = self.CreateStatusBar(1, wx.ST_SIZEGRIP)

        # Tool Bar
        self.All_Widgets_toolbar = wx.ToolBar(self, -1)
        self.SetToolBar(self.All_Widgets_toolbar)
        self.All_Widgets_toolbar.AddTool(
            wx.ID_UP, _("UpDown"),
            wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)),
            wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)),
            wx.ITEM_CHECK, _("Up or Down"), _("Up or Down"))
        self.All_Widgets_toolbar.AddTool(wx.ID_OPEN, _("Open"),
                                         wx.Bitmap(32, 32), wx.NullBitmap,
                                         wx.ITEM_NORMAL, _("Open a new file"),
                                         _("Open a new file"))
        # Tool Bar end
        self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM)
        self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.bitmap_button_icon1 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton, wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        self.bitmap_button_empty1 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap(10, 10))
        self.bitmap_button_icon2 = wx.BitmapButton(
            self.notebook_1_wxBitmapButton,
            wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY),
            style=wx.BORDER_NONE | wx.BU_BOTTOM)
        self.bitmap_button_art = wx.BitmapButton(
            self.notebook_1_wxBitmapButton,
            wx.ID_ANY,
            wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)),
            style=wx.BORDER_NONE | wx.BU_BOTTOM)
        self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "")
        self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.calendar_ctrl_1 = wx.adv.CalendarCtrl(
            self.notebook_1_wxCalendarCtrl,
            wx.ID_ANY,
            style=wx.adv.CAL_MONDAY_FIRST
            | wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION
            | wx.adv.CAL_SHOW_SURROUNDING_WEEKS)
        self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY,
                                      _("one (unchecked)"))
        self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY,
                                      _("two (checked)"))
        self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("three"),
                                      style=wx.CHK_2STATE)
        self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("four (unchecked)"),
                                      style=wx.CHK_3STATE)
        self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("five (checked)"),
                                      style=wx.CHK_3STATE
                                      | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox,
                                      wx.ID_ANY,
                                      _("six (undetermined)"),
                                      style=wx.CHK_3STATE
                                      | wx.CHK_ALLOW_3RD_STATE_FOR_USER)
        self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.check_list_box_1 = wx.CheckListBox(
            self.notebook_1_wxCheckListBox,
            wx.ID_ANY,
            choices=[_("one"), _("two"),
                     _("three"), _("four")])
        self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.choice_empty = wx.Choice(self.notebook_1_wxChoice,
                                      wx.ID_ANY,
                                      choices=[])
        self.choice_filled = wx.Choice(
            self.notebook_1_wxChoice,
            wx.ID_ANY,
            choices=[_("Item 1"), _("Item 2 (pre-selected)")])
        self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox,
                                           wx.ID_ANY,
                                           choices=[],
                                           style=0)
        self.combo_box_filled = wx.ComboBox(
            self.notebook_1_wxComboBox,
            wx.ID_ANY,
            choices=[_("Item 1 (pre-selected)"),
                     _("Item 2")],
            style=0)
        self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl(
            self.notebook_1_wxDatePickerCtrl,
            wx.ID_ANY,
            style=wx.adv.DP_SHOWCENTURY)
        self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20)
        self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid,
                                   wx.ID_ANY,
                                   size=(1, 1))
        self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.hyperlink_1 = wx.adv.HyperlinkCtrl(
            self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"),
            _("http://wxglade.sf.net"))
        self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox,
                                         wx.ID_ANY,
                                         choices=[],
                                         style=0)
        self.list_box_filled = wx.ListBox(
            self.notebook_1_wxListBox,
            wx.ID_ANY,
            choices=[_("Item 1"), _("Item 2 (pre-selected)")],
            style=wx.LB_MULTIPLE | wx.LB_SORT)
        self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl,
                                       wx.ID_ANY,
                                       style=wx.BORDER_SUNKEN | wx.LC_REPORT)
        self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                            wx.ID_ANY,
                                            _("radio_box_empty1"),
                                            choices=[""],
                                            majorDimension=1,
                                            style=wx.RA_SPECIFY_ROWS)
        self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                             wx.ID_ANY,
                                             _("radio_box_filled1"),
                                             choices=[
                                                 _("choice 1"),
                                                 _("choice 2 (pre-selected)"),
                                                 _("choice 3")
                                             ],
                                             majorDimension=0,
                                             style=wx.RA_SPECIFY_ROWS)
        self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox,
                                            wx.ID_ANY,
                                            _("radio_box_empty2"),
                                            choices=[""],
                                            majorDimension=1,
                                            style=wx.RA_SPECIFY_COLS)
        self.radio_box_filled2 = wx.RadioBox(
            self.notebook_1_wxRadioBox,
            wx.ID_ANY,
            _("radio_box_filled2"),
            choices=[_("choice 1"),
                     _("choice 2 (pre-selected)")],
            majorDimension=0,
            style=wx.RA_SPECIFY_COLS)
        self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY,
                                          _("Alice"),
                                          style=wx.RB_GROUP)
        self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY, _("Bob"))
        self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton,
                                          wx.ID_ANY, _("Malroy"))
        self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton,
                                       wx.ID_ANY, "")
        self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.slider_1 = wx.Slider(self.notebook_1_wxSlider,
                                  wx.ID_ANY,
                                  5,
                                  0,
                                  10,
                                  style=0)
        self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton,
                                          wx.ID_ANY,
                                          _("1"),
                                          style=wx.TE_RIGHT)
        self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton,
                                         wx.ID_ANY)
        self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl,
                                       wx.ID_ANY,
                                       "4",
                                       min=0,
                                       max=100)
        self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow(
            self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.splitter_1 = wx.SplitterWindow(
            self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY, style=0)
        self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY)
        self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY,
                                            _("top pane"))
        self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY)
        self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2,
                                               wx.ID_ANY, _("bottom pane"))
        self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow(
            self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL)
        self.splitter_2 = wx.SplitterWindow(
            self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY, style=0)
        self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY)
        self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY,
                                             _("left pane"))
        self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY)
        self.label_right_pane = wx.StaticText(self.splitter_2_pane_2,
                                              wx.ID_ANY, _("right pane"))
        self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap,
                                            wx.ID_ANY, wx.Bitmap(32, 32))
        self.bitmap_file = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY))
        self.bitmap_nofile = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY))
        self.bitmap_art = wx.StaticBitmap(
            self.notebook_1_wxStaticBitmap, wx.ID_ANY,
            wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32)))
        self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY,
                                           style=wx.LI_VERTICAL)
        self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY,
                                           style=wx.LI_VERTICAL)
        self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY)
        self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine,
                                           wx.ID_ANY)
        self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.label_1 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("red text (RGB)"),
                                     style=wx.ALIGN_CENTER)
        self.label_4 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("black on red (RGB)"),
                                     style=wx.ALIGN_CENTER)
        self.label_5 = wx.StaticText(self.notebook_1_wxStaticText,
                                     wx.ID_ANY,
                                     _("green on pink (RGB)"),
                                     style=wx.ALIGN_CENTER)
        self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY,
                                     _("Two labels with a"))
        self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY,
                                     _("spacer between"))
        self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl,
                                     wx.ID_ANY,
                                     _("This\nis\na\nmultiline\nwxTextCtrl"),
                                     style=wx.TE_CHARWRAP | wx.TE_MULTILINE
                                     | wx.TE_WORDWRAP)
        self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton,
                                        wx.ID_ANY, _("Toggle Button 1"))
        self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton,
                                        wx.ID_ANY,
                                        _("Toggle Button 2"),
                                        style=wx.BU_BOTTOM | wx.BU_EXACTFIT)
        self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl,
                                       wx.ID_ANY,
                                       style=0)
        self.static_line_1 = wx.StaticLine(self, wx.ID_ANY)
        self.button_5 = wx.Button(self, wx.ID_CLOSE, "")
        self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged,
                  self.notebook_1)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging,
                  self.notebook_1)
        self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)
Exemple #12
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.Size(646, 300),
                 style=wx.TAB_TRAVERSAL,
                 name=wx.EmptyString):
        wx.Panel.__init__(self,
                          parent,
                          id=id,
                          pos=pos,
                          size=size,
                          style=style,
                          name=name)

        Vsz1 = wx.BoxSizer(wx.VERTICAL)

        self.Spw1 = wx.SplitterWindow(self, wx.ID_ANY, wx.DefaultPosition,
                                      wx.DefaultSize,
                                      wx.SP_3DSASH | wx.SP_NO_XP_THEME)
        self.Spw1.Bind(wx.EVT_IDLE, self.Spw1OnIdle)

        self.pnl1 = wx.Panel(self.Spw1, wx.ID_ANY, wx.DefaultPosition,
                             wx.DefaultSize, wx.TAB_TRAVERSAL)
        Vsz2 = wx.BoxSizer(wx.VERTICAL)

        self.TLCtrl1 = wx.dataview.TreeListCtrl(
            self.pnl1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize,
            wx.dataview.TL_CHECKBOX | wx.dataview.TL_DEFAULT_STYLE
            | wx.dataview.TL_MULTIPLE)
        self.TLCtrl1.AppendColumn(u"ID", wx.COL_WIDTH_DEFAULT, wx.ALIGN_LEFT,
                                  wx.COL_RESIZABLE)
        self.TLCtrl1.AppendColumn(u"Name", wx.COL_WIDTH_DEFAULT, wx.ALIGN_LEFT,
                                  wx.COL_RESIZABLE)
        self.TLCtrl1.AppendColumn(u"dir", wx.COL_WIDTH_DEFAULT, wx.ALIGN_LEFT,
                                  wx.COL_RESIZABLE)
        self.TLCtrl1.AppendColumn(u"access", wx.COL_WIDTH_DEFAULT,
                                  wx.ALIGN_LEFT, wx.COL_RESIZABLE)

        Vsz2.Add(self.TLCtrl1, 1, wx.EXPAND | wx.ALL, 5)

        self.MyMenu = MS.GetData(u'Menu2.db', u'')
        self.DoMenu = MS.SetData(u'', u'', u'')

        self.fillList()

        self.pnl1.SetSizer(Vsz2)
        self.pnl1.Layout()
        Vsz2.Fit(self.pnl1)
        self.pnl2 = wx.Panel(self.Spw1, wx.ID_ANY, wx.DefaultPosition,
                             wx.DefaultSize, wx.TAB_TRAVERSAL)
        Vsz3 = wx.BoxSizer(wx.VERTICAL)

        self.btn1 = wx.Button(self.pnl2, wx.ID_ANY, u"Add", wx.DefaultPosition,
                              wx.DefaultSize, 0)
        Vsz3.Add(self.btn1, 0, wx.ALL, 5)

        self.btn2 = wx.Button(self.pnl2, wx.ID_ANY, u"Edit",
                              wx.DefaultPosition, wx.DefaultSize, 0)
        Vsz3.Add(self.btn2, 0, wx.ALL, 5)

        self.btn3 = wx.Button(self.pnl2, wx.ID_ANY, u"Delete",
                              wx.DefaultPosition, wx.DefaultSize, 0)
        Vsz3.Add(self.btn3, 0, wx.ALL, 5)

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

        self.btn4 = wx.Button(self.pnl2, wx.ID_ANY, u"Separator",
                              wx.DefaultPosition, wx.DefaultSize, 0)
        Vsz3.Add(self.btn4, 0, wx.ALL, 5)

        self.pnl2.SetSizer(Vsz3)
        self.pnl2.Layout()
        Vsz3.Fit(self.pnl2)
        self.Spw1.SplitVertically(self.pnl1, self.pnl2, 532)
        Vsz1.Add(self.Spw1, 1, wx.EXPAND, 5)

        VL = wx.BoxSizer(wx.VERTICAL)

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

        Vsz1.Add(VL, 0, wx.EXPAND, 5)

        Hz1 = wx.BoxSizer(wx.HORIZONTAL)

        self.btna = wx.Button(self, wx.ID_ANY, u"New Bar", wx.DefaultPosition,
                              wx.DefaultSize, 0)
        Hz1.Add(self.btna, 0, wx.ALL, 5)

        self.btnb = wx.Button(self, wx.ID_ANY, u"Change Bar",
                              wx.DefaultPosition, wx.DefaultSize, 0)
        Hz1.Add(self.btnb, 0, wx.ALL, 5)

        self.btnc = wx.Button(self, wx.ID_ANY, u"Delete Bar",
                              wx.DefaultPosition, wx.DefaultSize, 0)
        Hz1.Add(self.btnc, 0, wx.ALL, 5)

        Vsz1.Add(Hz1, 0, wx.EXPAND, 5)

        self.txt = stc.StyledTextCtrl()

        self.SetSizer(Vsz1)
        self.Layout()

        # Connect Events
        self.TLCtrl1.Bind(wx.dataview.EVT_TREELIST_ITEM_CHECKED,
                          self.DoshowItm)
        self.TLCtrl1.Bind(wx.dataview.EVT_TREELIST_ITEM_CONTEXT_MENU,
                          self.Thismenu)
        self.TLCtrl1.Bind(wx.dataview.EVT_DATAVIEW_ITEM_ACTIVATED,
                          self.Thismenu)
        self.btn1.Bind(wx.EVT_BUTTON, self.Additm)
        self.btn2.Bind(wx.EVT_BUTTON, self.edititm)
        self.btn3.Bind(wx.EVT_BUTTON, self.delitm)
        self.btn4.Bind(wx.EVT_BUTTON, self.aplyit)
        self.btna.Bind(wx.EVT_BUTTON, self.Nbar)
        self.btnb.Bind(wx.EVT_BUTTON, self.Cbar)
        self.btnc.Bind(wx.EVT_BUTTON, self.Dbar)
    def InitUI(self):

        self.splitter = wx.SplitterWindow(self, ID_SPLITTER, style=wx.SP_BORDER)
        self.splitter.SetMinimumPaneSize(50)

        p1 = MyListCtrl(self.splitter)
        p2 = MyListCtrl(self.splitter)
        self.splitter.SplitVertically(p1, p2)

        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SPLITTER_DCLICK, self.OnDoubleClick, id=ID_SPLITTER)

        filemenu= wx.Menu()
        filemenu.Append(ID_EXIT, "E&xit"," Terminate the program")
        editmenu = wx.Menu()
        netmenu = wx.Menu()
        showmenu = wx.Menu()
        configmenu = wx.Menu()
        helpmenu = wx.Menu()

        menuBar = wx.MenuBar()
        menuBar.Append(filemenu, "&File")
        menuBar.Append(editmenu, "&Edit")
        menuBar.Append(netmenu, "&Net")
        menuBar.Append(showmenu, "&Show")
        menuBar.Append(configmenu, "&Config")
        menuBar.Append(helpmenu, "&Help")
        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.OnExit, id=ID_EXIT)

        tb = self.CreateToolBar( wx.TB_HORIZONTAL | wx.NO_BORDER |
		      wx.TB_FLAT)

        tb.AddTool(10, 'Previous', wx.Bitmap('images/previous.png'), shortHelp='Previous')
        tb.AddTool(20, 'Up', wx.Bitmap('images/up.png'), shortHelp='Up one directory')
        tb.AddTool(30, 'Home', wx.Bitmap('images/home.png'), shortHelp='Home')
        tb.AddTool(40, 'Refresh', wx.Bitmap('images/refresh.png'), shortHelp='Refresh')
        tb.AddSeparator()
        tb.AddTool(50, 'Edit text', wx.Bitmap('images/textedit.png'), shortHelp='Edit text')
        tb.AddTool(60, 'Terminal', wx.Bitmap('images/terminal.png'), shortHelp='Terminal')
        tb.AddSeparator()
        tb.AddTool(70, 'Help', wx.Bitmap('images/help.png'), shortHelp='Show help')
        tb.Realize()

        self.sizer2 = wx.BoxSizer(wx.HORIZONTAL)

        button1 = wx.Button(self, ID_BUTTON + 1, "F3 View")
        button2 = wx.Button(self, ID_BUTTON + 2, "F4 Edit")
        button3 = wx.Button(self, ID_BUTTON + 3, "F5 Copy")
        button4 = wx.Button(self, ID_BUTTON + 4, "F6 Move")
        button5 = wx.Button(self, ID_BUTTON + 5, "F7 Mkdir")
        button6 = wx.Button(self, ID_BUTTON + 6, "F8 Delete")
        button7 = wx.Button(self, ID_BUTTON + 7, "F9 Rename")
        button8 = wx.Button(self, ID_EXIT, "F10 Quit")

        self.sizer2.Add(button1, 1, wx.EXPAND)
        self.sizer2.Add(button2, 1, wx.EXPAND)
        self.sizer2.Add(button3, 1, wx.EXPAND)
        self.sizer2.Add(button4, 1, wx.EXPAND)
        self.sizer2.Add(button5, 1, wx.EXPAND)
        self.sizer2.Add(button6, 1, wx.EXPAND)
        self.sizer2.Add(button7, 1, wx.EXPAND)
        self.sizer2.Add(button8, 1, wx.EXPAND)

        self.Bind(wx.EVT_BUTTON, self.OnExit, id=ID_EXIT)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.splitter,1,wx.EXPAND)
        self.sizer.Add(self.sizer2,0,wx.EXPAND)
        self.SetSizer(self.sizer)

        # size = wx.DisplaySize()
        # self.SetSize(size)

        sb = self.CreateStatusBar()
        sb.SetStatusText(os.getcwd())

        self.SetTitle("File Hunter")
        self.Center()
Exemple #14
0
    def __init__(self):
        super().__init__(parent=None, title="TFS查询 - V1.0.0", size=(1500, 600))
        self.Center()
        icon = wx.Icon('Source/fav.ico', wx.BITMAP_TYPE_ICO)

        # 获取团队
        teams = getTeam()
        teamsDic = {}

        for i, item in enumerate(teams):
            teamsDic[item['name']] = item['id']

        list_values = [i for i in teamsDic.values()]
        list_keys = [i for i in teamsDic.keys()]

        #获取团队成员
        global project
        project = list_firstOrDefault(lambda x: x["name"] == 'RMIS', teams)
        # users = getTeamUser(project["id"])

        swindow = wx.SplitterWindow(parent=self, id=-1)
        left = wx.Panel(parent=swindow)
        right = wx.Panel(parent=swindow)

        # 设置左右布局的分割窗口left和right
        swindow.SplitVertically(left, right, 200)

        # 设置最小窗格大小,左右布局指左边窗口大小
        swindow.SetMinimumPaneSize(80)

        # 创建一棵树
        self.tree = self.CreateTreeCtrl(left, project['id'])
        self.Bind(wx.EVT_TREE_SEL_CHANGING, self.on_click, self.tree)

        # 为left面板设置一个布局管理器
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        left.SetSizer(vbox1)
        vbox1.Add(self.tree, 1, flag=wx.EXPAND | wx.ALL, border=5)

        # 为right面板设置一个布局管理器
        vbox2 = wx.BoxSizer(wx.VERTICAL)
        right.SetSizer((vbox2))

        # frame = GridFrame(right)
        # Create a wxGrid object
        global grid
        grid = wx.grid.Grid(right, -1)

        # Then we call CreateGrid to set the dimensions of the grid
        # (100 rows and 10 columns in this example)
        grid.CreateGrid(200, 30)

        # We can set the sizes of individual rows and columns
        # in pixels
        # grid.SetRowSize(0, 60)
        # grid.SetColSize(0, 120)

        # And set grid cell contents as strings
        # grid.SetCellValue(0, 0, 'wxGrid is good')

        # We can specify that some cells are read.only
        # grid.SetCellValue(0, 3, 'This is read.only')
        # grid.SetReadOnly(0, 3)

        # Colours can be specified for grid cell contents
        # grid.SetCellValue(3, 3, 'green on grey')
        # grid.SetCellTextColour(3, 3, wx.GREEN)
        # grid.SetCellBackgroundColour(3, 3, wx.LIGHT_GREY)

        # We can specify the some cells will store numeric
        # values rather than strings. Here we set grid column 5
        # to hold floating point values displayed with width of 6
        # and precision of 2
        # grid.SetColFormatFloat(5, 6, 2)
        # grid.SetCellValue(0, 6, '3.1415')

        # 标题
        lbl = wx.StaticText(right, -1, style=wx.ALIGN_CENTER)
        font = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.NORMAL)
        lbl.SetFont(font)
        lbl.SetLabel('统计信息')
        vbox2.Add(lbl, 3, wx.EXPAND)

        # 操作
        h_box_sizer = wx.BoxSizer(wx.HORIZONTAL)

        v_box_sizer = wx.BoxSizer(wx.VERTICAL)

        gs = wx.StaticText(right,
                           -1,
                           style=wx.ALIGN_LEFT | wx.ST_ELLIPSIZE_MIDDLE,
                           label='工时:')
        # gsNum = wx.TextCtrl(right, -1, style = wx.ALIGN_LEFT)
        sc = wx.SpinCtrl(right, -1, "", (30, 20), (80, -1))
        sc.SetRange(1, 100)
        sc.SetValue(40)

        btn = wx.Button(right, -1, "统计", style=wx.ALIGN_LEFT, size=(60, 27))
        btn1 = wx.Button(right,
                         -1,
                         "导出Excel",
                         style=wx.ALIGN_LEFT,
                         size=(100, 27))

        # xztd = wx.StaticText(right,-1, style = wx.ALIGN_LEFT | wx.ST_ELLIPSIZE_MIDDLE,label='选择团队:')
        xztd = wx.StaticText(right, wx.ID_ANY, "选择团队:", (10, 10), (100, 27),
                             wx.ALIGN_CENTER)
        xztd.SetForegroundColour("White")
        xztd.SetBackgroundColour("Black")
        # font1=wx.Font(-10,wx.SCRIPT,wx.NORMAL,wx.NORMAL,False,)
        # xztd.SetFont(font)

        ch1 = wx.ComboBox(right,
                          -1,
                          value='RMIS',
                          choices=list_keys,
                          style=wx.CB_SORT)
        #添加事件处理
        self.Bind(wx.EVT_COMBOBOX, self.on_combobox, ch1)

        cygl = wx.StaticText(right,
                             -1,
                             style=wx.ALIGN_LEFT | wx.ST_ELLIPSIZE_MIDDLE,
                             label='成员过滤:')
        list2 = ["全部", "陈金伟", "韩小江", "姜智林", "杨博", "邓东林"]
        ch2 = wx.ComboBox(right,
                          -1,
                          value='全部',
                          choices=list2,
                          style=wx.CB_SORT)
        #添加事件处理
        self.Bind(wx.EVT_COMBOBOX, self.on_combobox, ch2)

        h_box_sizer.Add(xztd)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(ch1)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(cygl)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(ch2)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(gs)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(sc)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(btn)
        h_box_sizer.Add((10, -1))
        h_box_sizer.Add(btn1)
        v_box_sizer.Add(h_box_sizer, proportion=0, flag=wx.EXPAND)
        vbox2.Add(v_box_sizer, -1, wx.EXPAND)
        vbox2.Add((-1, 15))

        # 统计信息
        lbl1 = wx.StaticText(right,
                             -1,
                             style=wx.ALIGN_LEFT | wx.ST_ELLIPSIZE_MIDDLE)
        lbl1.SetLabel('张三')
        lbl1.SetForegroundColour((255, 0, 0))
        lbl1.SetBackgroundColour((0, 0, 0))

        vbox2.Add(lbl1, -1, wx.EXPAND)
        vbox2.Add(grid, -1, flag=wx.EXPAND, border=5)

        self.SetIcon(icon)
Exemple #15
0
    def __init__(self, frame, data):
        self.data = data
        self.palette = matplotlib.cm.jet
        data.register_for_updates(self.on_update)
        self.frame = frame
        self.plate_bitmap = None
        self.frame.Sizer = wx.BoxSizer(wx.VERTICAL)
        self.toolbar = wx.ToolBar(self.frame)
        self.frame.Sizer.Add(self.toolbar, 0, wx.EXPAND)
        self.plate_choice = wx.Choice(self.toolbar)
        self.toolbar.AddControl(self.plate_choice)
        self.toolbar.Realize()
        self.splitter = wx.SplitterWindow(self.frame)
        self.frame.Sizer.Add(self.splitter, 1, wx.EXPAND)
        self.plate_panel = wx.Panel(self.splitter)
        rows, cols = data.plate_layout
        w, h = self.plate_panel.GetTextExtent("".join(["00"] * cols))
        h *= rows
        self.plate_panel.SetMinSize((w, h))
        self.canvas_panel = wx.Panel(self.splitter)
        self.canvas_panel.Sizer = wx.BoxSizer(wx.VERTICAL)
        control_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.canvas_panel.Sizer.Add(control_sizer, 0, wx.EXPAND | wx.ALL, 2)
        self.site_grid = wx.grid.Grid(self.canvas_panel)
        self.site_grid.SetDefaultRenderer(wx.grid.GridCellFloatRenderer())
        self.site_grid.SetDefaultEditor(wx.grid.GridCellFloatEditor())
        self.site_grid.CreateGrid(1, 2)
        self.site_grid.SetColLabelValue(0, "X")
        self.site_grid.SetColLabelValue(1, "Y")
        control_sizer.Add(self.site_grid, 0,
                          wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.ALL, 5)

        self.channel_grid = wx.grid.Grid(self.canvas_panel)
        self.channel_grid.CreateGrid(1, 4)
        self.channel_grid.SetColLabelValue(0, "Red")
        self.channel_grid.SetColLabelValue(1, "Green")
        self.channel_grid.SetColLabelValue(2, "Blue")
        self.channel_grid.SetColLabelValue(3, "Alpha")
        self.channel_grid.SetDefaultEditor(wx.grid.GridCellNumberEditor())
        self.channel_grid.SetDefaultRenderer(wx.grid.GridCellNumberRenderer())
        control_sizer.Add(self.channel_grid, 0,
                          wx.ALIGN_RIGHT | wx.ALIGN_TOP | wx.ALL, 5)
        self.figure = matplotlib.figure.Figure()
        self.axes = self.figure.add_axes((0.05, 0.05, .9, .9))
        self.canvas = FigureCanvasWxAgg(self.canvas_panel, -1, self.figure)
        self.canvas_panel.Sizer.Add(self.canvas, 1, wx.EXPAND)
        #
        # The following is largely taken from the matplotlib examples:
        # http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
        #
        self.toolbar = NavigationToolbar2Wx(self.canvas)
        self.toolbar.Realize()
        if wx.Platform == '__WXMAC__':
            # Mac platform (OSX 10.3, MacPython) does not seem to cope with
            # having a toolbar in a sizer. This work-around gets the buttons
            # back, but at the expense of having the toolbar at the top
            self.frame.SetToolBar(self.toolbar)
        else:
            # On Windows platform, default window size is incorrect, so set
            # toolbar width to figure width.
            tw, th = self.toolbar.GetSizeTuple()
            fw, fh = self.canvas.GetSizeTuple()
            # By adding toolbar in sizer, we are able to put it at the bottom
            # of the frame - so appearance is closer to GTK version.
            # As noted above, doesn't work for Mac.
            self.toolbar.SetSize(wx.Size(fw, th))
            self.canvas_panel.Sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND)
        # update the axes menu on the toolbar
        self.toolbar.update()
        self.image_dict = None
        self.image_dict_lock = multiprocessing.RLock()
        self.image_dict_generation = 0
        self.splitter.SplitVertically(self.plate_panel, self.canvas_panel)
        self.plate_panel.Bind(wx.EVT_PAINT, self.on_paint_plate)
        self.plate_panel.Bind(wx.EVT_ERASE_BACKGROUND,
                              self.on_erase_background)
        self.plate_panel.Bind(wx.EVT_SIZE, self.on_plate_size)
        self.plate_panel.Bind(wx.EVT_MOTION, self.on_plate_motion)
        self.plate_panel.Bind(wx.EVT_LEFT_DOWN, self.on_plate_click)
        self.plate_choice.Bind(wx.EVT_CHOICE, self.on_plate_choice_evt)
        self.site_grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
                            lambda event: self.update_figure())
        self.channel_grid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
                               lambda event: self.update_figure())
        self.on_update()
        self.frame.Layout()
Exemple #16
0
	def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"XPArduino", pos = wx.DefaultPosition, size = wx.Size( 988,641 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
		
		#self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
		self.SetSizeHints( 500, 500)
		print("still going1")
		bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
		
		self.m_splitter1 = wx.SplitterWindow( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), wx.SP_3D )
		self.m_splitter1.Bind( wx.EVT_IDLE, self.m_splitter1OnIdle )
		self.m_splitter1.SetMinimumPaneSize( 20 )
		
		self.m_panel6 = wx.Panel( self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.Size( 200,-1 ), wx.NO_BORDER|wx.TAB_TRAVERSAL )
		self.m_panel6.SetMinSize( wx.Size( 200,-1 ) )
		print("still going2")
		bSizer11 = wx.BoxSizer( wx.VERTICAL )
		
		bSizer11.SetMinSize( wx.Size( 200,-1 ) ) 
		self.m_staticText3 = wx.StaticText( self.m_panel6, wx.ID_ANY, u" Arduino Boards", wx.Point( -1,-1 ), wx.Size( -1,-1 ), 0 )
		self.m_staticText3.Wrap( -1 )
		self.m_staticText3.SetFont( wx.Font( 10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, wx.EmptyString ) )
		self.m_staticText3.SetForegroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT ) )
		self.m_staticText3.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DDKSHADOW ) )
		
		bSizer11.Add( self.m_staticText3, 0, wx.ALIGN_CENTER|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL|wx.EXPAND, 0 )
		print("still going2.1")
		self.Arduino_dataViewTreeCtrl = wx.dataview.DataViewTreeCtrl( self.m_panel6, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), wx.dataview.DV_NO_HEADER|wx.HSCROLL|wx.SIMPLE_BORDER )
		print("still going2.1.1")
		bSizer11.Add( self.Arduino_dataViewTreeCtrl, 1, wx.EXPAND|wx.TOP, 0 )
		
		
		self.m_panel6.SetSizer( bSizer11 )
		self.m_panel6.Layout()
		self.m_panel10 = wx.Panel( self.m_splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		self.m_splitter1.SplitVertically( self.m_panel6, self.m_panel10, 200 )
		bSizer3.Add( self.m_splitter1, 1, wx.EXPAND, 5 )
		print("still going2.2")
		
		self.SetSizer( bSizer3 )
		self.Layout()
		self.m_statusBar1 = self.CreateStatusBar( 1, 0, wx.ID_ANY )
		self.m_toolBar1 = self.CreateToolBar( wx.TB_HORIZONTAL|wx.SIMPLE_BORDER, wx.ID_ANY ) 
		self.m_toolBar1.Realize() 
		print("still going2.3")
		self.m_menubar1 = wx.MenuBar( 0 )
		self.m_menu1 = wx.Menu()
		self.m_menuItemAddArduino = wx.MenuItem( self.m_menu1, wx.ID_ANY, u"Add Arduino...", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu1.AppendItem( self.m_menuItemAddArduino )
		print("still going2.4")
		self.menuItemQuit = wx.MenuItem( self.m_menu1, wx.ID_ANY, u"Exit", wx.EmptyString, wx.ITEM_NORMAL )
		self.m_menu1.AppendItem( self.menuItemQuit )
		
		self.m_menubar1.Append( self.m_menu1, u"File" ) 
		
		self.SetMenuBar( self.m_menubar1 )
		
		
		self.Centre( wx.BOTH )
		print("still going3")
		# Connect Events
		self.Bind( wx.EVT_MENU, self.addArduinoBoard, id = self.m_menuItemAddArduino.GetId() )
		self.Bind( wx.EVT_MENU, self.exitApp, id = self.menuItemQuit.GetId() )
Exemple #17
0
    def __init__(self, *args, **kwds):
        self.mini_ploter = MiniPloterSerialInterface(0, 9600, 1)
        self.couter_of_plotere_max_steps = 100
        self.couter_x_steps = 0
        self.couter_y_steps = 0

        # begin wxGlade: mini_ploter_01.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.notebook_1 = wx.Notebook(self, -1, style=wx.NB_RIGHT)
        self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1)
        self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1)
        self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
        self.window_1 = wx.SplitterWindow(self,
                                          -1,
                                          style=wx.SP_3D | wx.SP_BORDER)
        self.slider_x = wx.Slider(self.window_1,
                                  -1,
                                  0,
                                  0,
                                  self.couter_of_plotere_max_steps,
                                  style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS
                                  | wx.SL_LABELS | wx.SL_SELRANGE)
        self.slider_y = wx.Slider(self.window_1,
                                  -1,
                                  0,
                                  0,
                                  self.couter_of_plotere_max_steps,
                                  style=wx.SL_VERTICAL | wx.SL_AUTOTICKS
                                  | wx.SL_LABELS | wx.SL_INVERSE)
        self.button_home = wx.Button(self.notebook_1_pane_1, -1, "HOME")
        self.button_restart = wx.Button(self.notebook_1_pane_1, -1, "RESTART")
        self.button_stop = wx.Button(self.notebook_1_pane_1, -1, "STOP")
        self.button_1_fix = wx.Button(self.notebook_1_pane_2, -1, "")
        self.button_x_up = wx.Button(self.notebook_1_pane_2, -1,
                                     "X - UP [ j ]")
        self.button_3_fix = wx.Button(self.notebook_1_pane_2, -1, "")
        self.button_x_up_speed = wx.Button(self.notebook_1_pane_2, -1,
                                           "Xx5 [ f ]")
        self.button_y_up = wx.Button(self.notebook_1_pane_2, -1,
                                     "Y - UP [ i ]")
        self.button_y_down = wx.Button(self.notebook_1_pane_2, -1,
                                       "Y-DOWN [ k ]")
        self.button_y_up_speed = wx.Button(self.notebook_1_pane_2, -1,
                                           "Yx5 [ t ]")
        self.button_y_down_speed = wx.Button(self.notebook_1_pane_2, -1,
                                             "Yx5 [ g ]")
        self.button_2_fix = wx.Button(self.notebook_1_pane_2, -1, "")
        self.button_x_down = wx.Button(self.notebook_1_pane_2, -1,
                                       "X-DOWN [ l ]")
        self.button_4_fix = wx.Button(self.notebook_1_pane_2, -1, "")
        self.button_x_down_speed = wx.Button(self.notebook_1_pane_2, -1,
                                             "Xx5 [ h ]")
        self.button_1_test = wx.Button(self.notebook_1_pane_2, -1,
                                       "test [ 1 ]")
        self.button_2_test = wx.Button(self.notebook_1_pane_2, -1,
                                       "test [ 2 ]")
        self.button_3_test = wx.Button(self.notebook_1_pane_2, -1,
                                       "test [ 3 ]")
        self.button_4_test = wx.Button(self.notebook_1_pane_2, -1,
                                       "test [ 4 ]")
        self.list_box_set_motor_speed = wx.ListBox(
            self.notebook_1_pane_3,
            -1,
            choices=["5", "7", "10", "20", "50"],
            style=wx.LB_SINGLE)

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMMAND_SCROLL, self.slider_x_scrool_event,
                  self.slider_x)
        self.Bind(wx.EVT_COMMAND_SCROLL, self.slider_y_scrool_event,
                  self.slider_y)
        self.Bind(wx.EVT_BUTTON, self.button_home_click_event,
                  self.button_home)
        self.Bind(wx.EVT_BUTTON, self.button_restart_click_event,
                  self.button_restart)
        self.Bind(wx.EVT_BUTTON, self.button_stop_click_event,
                  self.button_stop)
        self.Bind(wx.EVT_BUTTON, self.button_x_up_evt, self.button_x_up)
        self.Bind(wx.EVT_BUTTON, self.button_x_up_speed_evt,
                  self.button_x_up_speed)
        self.Bind(wx.EVT_BUTTON, self.button_y_up_evt, self.button_y_up)
        self.Bind(wx.EVT_BUTTON, self.button_y_down_evt, self.button_y_down)
        self.Bind(wx.EVT_BUTTON, self.button_y_up_speed_evt,
                  self.button_y_up_speed)
        self.Bind(wx.EVT_BUTTON, self.button_y_down_speed_evt,
                  self.button_y_down_speed)
        self.Bind(wx.EVT_BUTTON, self.button_x_down_evt, self.button_x_down)
        self.Bind(wx.EVT_BUTTON, self.button_x_down_speed_evt,
                  self.button_x_down_speed)
        self.Bind(wx.EVT_BUTTON, self.button_1_test_evt, self.button_1_test)
        self.Bind(wx.EVT_BUTTON, self.button_2_test_evt, self.button_2_test)
        self.Bind(wx.EVT_BUTTON, self.button_3_test_evt, self.button_3_test)
        self.Bind(wx.EVT_BUTTON, self.button_4_test_evt, self.button_4_test)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.set_motor_speed_dclick_evt,
                  self.list_box_set_motor_speed)
        self.Bind(wx.EVT_LISTBOX, self.set_motor_speed_evt,
                  self.list_box_set_motor_speed)
Exemple #18
0
    def __init__(self, parent):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.Size(1050, 407),
                          style=wx.TAB_TRAVERSAL)

        bSizer16 = wx.BoxSizer(wx.VERTICAL)

        bSizer3 = wx.BoxSizer(wx.HORIZONTAL)

        self.m_splitter1 = wx.SplitterWindow(self, wx.ID_ANY,
                                             wx.DefaultPosition,
                                             wx.DefaultSize,
                                             wx.SP_3D | wx.SP_LIVE_UPDATE)
        self.m_splitter1.Bind(wx.EVT_IDLE, self.m_splitter1OnIdle)

        self.m_panel2 = wx.Panel(self.m_splitter1, wx.ID_ANY,
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.TAB_TRAVERSAL)
        bSizer2 = wx.BoxSizer(wx.VERTICAL)

        self.search_snapeda = wx.SearchCtrl(
            self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition,
            wx.DefaultSize, wx.TE_NOHIDESEL | wx.TE_PROCESS_ENTER)
        self.search_snapeda.ShowSearchButton(True)
        self.search_snapeda.ShowCancelButton(True)
        self.search_snapeda.SetMinSize(wx.Size(150, -1))

        bSizer2.Add(self.search_snapeda, 0,
                    wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, 5)

        self.tree_snapedas = wx.dataview.DataViewCtrl(self.m_panel2, wx.ID_ANY,
                                                      wx.DefaultPosition,
                                                      wx.DefaultSize, 0)
        bSizer2.Add(self.tree_snapedas, 1, wx.ALL | wx.EXPAND, 5)

        self.m_panel2.SetSizer(bSizer2)
        self.m_panel2.Layout()
        bSizer2.Fit(self.m_panel2)
        self.m_panel1 = wx.Panel(self.m_splitter1, wx.ID_ANY,
                                 wx.DefaultPosition, wx.DefaultSize,
                                 wx.TAB_TRAVERSAL)
        bSizer6 = wx.BoxSizer(wx.VERTICAL)

        self.bitmap_preview = wx.StaticBitmap(self.m_panel1, wx.ID_ANY,
                                              wx.NullBitmap,
                                              wx.DefaultPosition,
                                              wx.DefaultSize, 0)
        bSizer6.Add(self.bitmap_preview, 1, wx.ALL | wx.EXPAND, 5)

        self.m_panel1.SetSizer(bSizer6)
        self.m_panel1.Layout()
        bSizer6.Fit(self.m_panel1)
        self.m_splitter1.SplitVertically(self.m_panel2, self.m_panel1, 750)
        bSizer3.Add(self.m_splitter1, 1, wx.EXPAND, 5)

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

        m_sdbSizer2 = wx.StdDialogButtonSizer()
        self.m_sdbSizer2OK = wx.Button(self, wx.ID_OK)
        m_sdbSizer2.AddButton(self.m_sdbSizer2OK)
        self.m_sdbSizer2Cancel = wx.Button(self, wx.ID_CANCEL)
        m_sdbSizer2.AddButton(self.m_sdbSizer2Cancel)
        m_sdbSizer2.Realize()

        bSizer16.Add(m_sdbSizer2, 0, wx.EXPAND, 5)

        self.SetSizer(bSizer16)
        self.Layout()

        # Connect Events
        self.search_snapeda.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN,
                                 self.onSearchSnapedaButton)
        self.search_snapeda.Bind(wx.EVT_TEXT_ENTER, self.onSearchSnapedaEnter)
        self.m_sdbSizer2Cancel.Bind(wx.EVT_BUTTON, self.onButtonCancelClick)
        self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onButtonOkClick)
Exemple #19
0
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self,
                          id=wxID_FRAME1,
                          name='',
                          parent=prnt,
                          pos=wx.Point(556, 295),
                          size=wx.Size(516, 476),
                          style=wx.DEFAULT_FRAME_STYLE,
                          title='Everything')
        self._init_utils()
        self.SetClientSize(wx.Size(508, 449))
        self.SetMenuBar(self.menuBar1)
        self.Center(wx.BOTH)

        self.toolBar1 = wx.ToolBar(id=wxID_FRAME1TOOLBAR1,
                                   name='toolBar1',
                                   parent=self,
                                   pos=wx.Point(0, 0),
                                   size=wx.Size(508, 27),
                                   style=wx.TB_HORIZONTAL | wx.NO_BORDER)
        self.SetToolBar(self.toolBar1)

        self.statusBar1 = wx.StatusBar(id=wxID_FRAME1STATUSBAR1,
                                       name='statusBar1',
                                       parent=self,
                                       style=0)
        self.statusBar1.SetPosition(wx.Point(0, 308))
        self.statusBar1.SetSize(wx.Size(422, 20))
        self._init_coll_statusBar1_Fields(self.statusBar1)
        self.SetStatusBar(self.statusBar1)

        self.notebook1 = wx.Notebook(id=wxID_FRAME1NOTEBOOK1,
                                     name='notebook1',
                                     parent=self,
                                     pos=wx.Point(0, 27),
                                     size=wx.Size(508, 383),
                                     style=0)

        self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1,
                               name='panel1',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.splitterWindow1 = wx.SplitterWindow(id=wxID_FRAME1SPLITTERWINDOW1,
                                                 name='splitterWindow1',
                                                 parent=self.panel1,
                                                 point=wx.Point(8, 8),
                                                 size=wx.Size(200, 100),
                                                 style=wx.SP_3D)

        self.scrolledWindow1 = wx.ScrolledWindow(id=wxID_FRAME1SCROLLEDWINDOW1,
                                                 name='scrolledWindow1',
                                                 parent=self.splitterWindow1,
                                                 pos=wx.Point(2, 2),
                                                 size=wx.Size(98, 96),
                                                 style=wx.SUNKEN_BORDER
                                                 | wx.TAB_TRAVERSAL)
        self.scrolledWindow1.SetToolTipString('wxScrolledWindow')

        self.sashWindow1 = wx.SashWindow(id=wxID_FRAME1SASHWINDOW1,
                                         name='sashWindow1',
                                         parent=self.splitterWindow1,
                                         pos=wx.Point(107, 2),
                                         size=wx.Size(91, 96),
                                         style=wx.CLIP_CHILDREN | wx.SW_3D)
        self.splitterWindow1.SplitVertically(self.scrolledWindow1,
                                             self.sashWindow1, 100)

        self.sashLayoutWindow1 = wx.SashLayoutWindow(
            id=wxID_FRAME1SASHLAYOUTWINDOW1,
            name='sashLayoutWindow1',
            parent=self.panel1,
            pos=wx.Point(8, 120),
            size=wx.Size(200, 80),
            style=wx.CLIP_CHILDREN | wx.SW_3D)

        self.window1 = wx.Window(id=wxID_FRAME1WINDOW1,
                                 name='window1',
                                 parent=self.panel1,
                                 pos=wx.Point(216, 120),
                                 size=wx.Size(96, 80),
                                 style=wx.SIMPLE_BORDER)
        self.window1.SetCursor(self.stockCursor1)

        self.dynamicSashWindow1 = wx.gizmos.DynamicSashWindow(
            id=wxID_FRAME1DYNAMICSASHWINDOW1,
            name='dynamicSashWindow1',
            parent=self.panel1,
            pos=wx.Point(216, 8),
            size=wx.Size(100, 100),
            style=wx.CLIP_CHILDREN)

        self.panel2 = wx.Panel(id=wxID_FRAME1PANEL2,
                               name='panel2',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
                                         label='staticText1',
                                         name='staticText1',
                                         parent=self.panel2,
                                         pos=wx.Point(16, 16),
                                         size=wx.Size(52, 13),
                                         style=0)

        self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1,
                                     name='textCtrl1',
                                     parent=self.panel2,
                                     pos=wx.Point(16, 40),
                                     size=wx.Size(100, 21),
                                     style=0,
                                     value='textCtrl1')

        self.comboBox1 = wx.ComboBox(choices=[],
                                     id=wxID_FRAME1COMBOBOX1,
                                     name='comboBox1',
                                     parent=self.panel2,
                                     pos=wx.Point(16, 72),
                                     size=wx.Size(125, 21),
                                     style=0,
                                     validator=wx.DefaultValidator,
                                     value='comboBox1')

        self.choice1 = wx.Choice(choices=[],
                                 id=wxID_FRAME1CHOICE1,
                                 name='choice1',
                                 parent=self.panel2,
                                 pos=wx.Point(16, 104),
                                 size=wx.Size(125, 21),
                                 style=0,
                                 validator=wx.DefaultValidator)

        self.checkBox1 = wx.CheckBox(id=wxID_FRAME1CHECKBOX1,
                                     label='checkBox1',
                                     name='checkBox1',
                                     parent=self.panel2,
                                     pos=wx.Point(16, 136),
                                     size=wx.Size(73, 13),
                                     style=0)

        self.radioButton1 = wx.RadioButton(id=wxID_FRAME1RADIOBUTTON1,
                                           label='radioButton1',
                                           name='radioButton1',
                                           parent=self.panel2,
                                           pos=wx.Point(16, 160),
                                           size=wx.Size(80, 20),
                                           style=0)

        self.slider1 = wx.Slider(id=wxID_FRAME1SLIDER1,
                                 maxValue=100,
                                 minValue=0,
                                 name='slider1',
                                 parent=self.panel2,
                                 point=wx.Point(152, 16),
                                 size=wx.Size(136, 20),
                                 style=wx.SL_HORIZONTAL,
                                 validator=wx.DefaultValidator,
                                 value=0)
        self.slider1.Bind(wx.EVT_SCROLL, self.OnSlider1Slider)

        self.scrollBar1 = wx.ScrollBar(id=wxID_FRAME1SCROLLBAR1,
                                       name='scrollBar1',
                                       parent=self.panel2,
                                       pos=wx.Point(16, 192),
                                       size=wx.Size(120, 14),
                                       style=wx.SB_HORIZONTAL)
        self.scrollBar1.SetThumbPosition(0)

        self.staticBitmap1 = wx.StaticBitmap(
            bitmap=Everything_img.getBoaBitmap(),
            id=wxID_FRAME1STATICBITMAP1,
            name='staticBitmap1',
            parent=self.panel2,
            pos=wx.Point(160, 136),
            size=wx.Size(16, 16),
            style=0)

        self.staticLine1 = wx.StaticLine(id=wxID_FRAME1STATICLINE1,
                                         name='staticLine1',
                                         parent=self.panel2,
                                         pos=wx.Point(15, 216),
                                         size=wx.Size(121, 2),
                                         style=0)

        self.staticBox1 = wx.StaticBox(id=wxID_FRAME1STATICBOX1,
                                       label='staticBox1',
                                       name='staticBox1',
                                       parent=self.panel2,
                                       pos=wx.Point(152, 120),
                                       size=wx.Size(144, 40),
                                       style=0)

        self.htmlWindow1 = wx.html.HtmlWindow(id=wxID_FRAME1HTMLWINDOW1,
                                              name='htmlWindow1',
                                              parent=self.panel2,
                                              pos=wx.Point(152, 168),
                                              size=wx.Size(144, 80),
                                              style=wx.html.HW_SCROLLBAR_AUTO)

        self.lEDNumberCtrl1 = wx.gizmos.LEDNumberCtrl(
            id=wxID_FRAME1LEDNUMBERCTRL1,
            parent=self.panel2,
            pos=wx.Point(152, 40),
            size=wx.Size(136, 40),
            style=wx.gizmos.LED_ALIGN_CENTER)
        self.lEDNumberCtrl1.SetValue('123')

        self.panel3 = wx.Panel(id=wxID_FRAME1PANEL3,
                               name='panel3',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.button1 = wx.Button(id=wxID_FRAME1BUTTON1,
                                 label='button1',
                                 name='button1',
                                 parent=self.panel3,
                                 pos=wx.Point(16, 16),
                                 size=wx.Size(75, 23),
                                 style=0)
        self.button1.Bind(wx.EVT_BUTTON,
                          self.OnButton1Button,
                          id=wxID_FRAME1BUTTON1)
        self.button1.Bind(wx.EVT_LEFT_UP, self.OnButton1LeftUp)

        self.bitmapButton1 = wx.BitmapButton(
            bitmap=Everything_img.getBoaBitmap(),
            id=wxID_FRAME1BITMAPBUTTON1,
            name='bitmapButton1',
            parent=self.panel3,
            pos=wx.Point(16, 56),
            size=wx.Size(72, 24),
            style=wx.BU_AUTODRAW,
            validator=wx.DefaultValidator)
        self.bitmapButton1.Bind(wx.EVT_BUTTON,
                                self.OnBitmapbutton1Button,
                                id=wxID_FRAME1BITMAPBUTTON1)

        self.spinButton1 = wx.SpinButton(id=wxID_FRAME1SPINBUTTON1,
                                         name='spinButton1',
                                         parent=self.panel3,
                                         pos=wx.Point(136, 96),
                                         size=wx.Size(32, 16),
                                         style=wx.SP_HORIZONTAL)
        self.spinButton1.Bind(wx.EVT_COMMAND_SCROLL,
                              self.OnSpinbutton1CommandScroll,
                              id=wxID_FRAME1SPINBUTTON1)

        self.toggleButton1 = wx.ToggleButton(id=wxID_FRAME1TOGGLEBUTTON1,
                                             label='toggleButton1',
                                             name='toggleButton1',
                                             parent=self.panel3,
                                             pos=wx.Point(104, 16),
                                             size=wx.Size(81, 23),
                                             style=0)
        self.toggleButton1.Bind(wx.EVT_BUTTON,
                                self.OnTogglebutton1Button,
                                id=wxID_FRAME1TOGGLEBUTTON1)

        self.genButton1 = wx.lib.buttons.GenButton(ID=wxID_FRAME1GENBUTTON1,
                                                   label='genButton1',
                                                   name='genButton1',
                                                   parent=self.panel3,
                                                   pos=wx.Point(16, 160),
                                                   size=wx.Size(88, 37),
                                                   style=0)

        self.genBitmapButton1 = wx.lib.buttons.GenBitmapButton(
            ID=wxID_FRAME1GENBITMAPBUTTON1,
            bitmap=Everything_img.getBoaBitmap(),
            name='genBitmapButton1',
            parent=self.panel3,
            pos=wx.Point(16, 192),
            size=wx.Size(59, 58),
            style=0)

        self.genToggleButton1 = wx.lib.buttons.GenToggleButton(
            ID=wxID_FRAME1GENTOGGLEBUTTON1,
            label='genToggleButton1',
            name='genToggleButton1',
            parent=self.panel3,
            pos=wx.Point(104, 160),
            size=wx.Size(113, 37),
            style=0)

        self.genBitmapToggleButton1 = wx.lib.buttons.GenBitmapToggleButton(
            ID=wxID_FRAME1GENBITMAPTOGGLEBUTTON1,
            bitmap=Everything_img.getBoaBitmap(),
            name='genBitmapToggleButton1',
            parent=self.panel3,
            pos=wx.Point(72, 192),
            size=wx.Size(59, 58),
            style=0)

        self.genBitmapTextToggleButton1 = wx.lib.buttons.GenBitmapTextToggleButton(
            ID=wxID_FRAME1GENBITMAPTEXTTOGGLEBUTTON1,
            bitmap=Everything_img.getBoaBitmap(),
            label='genBitmapTextToggleButton1',
            name='genBitmapTextToggleButton1',
            parent=self.panel3,
            pos=wx.Point(128, 192),
            size=wx.Size(88, 58),
            style=0)

        self.contextHelpButton1 = wx.ContextHelpButton(parent=self.panel3,
                                                       pos=wx.Point(136, 64),
                                                       size=wx.Size(20, 19),
                                                       style=wx.BU_AUTODRAW)

        self.panel4 = wx.Panel(id=wxID_FRAME1PANEL4,
                               name='panel4',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.radioBox1 = wx.RadioBox(choices=['asd'],
                                     id=wxID_FRAME1RADIOBOX1,
                                     label='radioBox1',
                                     majorDimension=1,
                                     name='radioBox1',
                                     parent=self.panel4,
                                     point=wx.Point(16, 16),
                                     size=wx.DefaultSize,
                                     style=wx.RA_SPECIFY_COLS,
                                     validator=wx.DefaultValidator)

        self.listBox1 = wx.ListBox(choices=[],
                                   id=wxID_FRAME1LISTBOX1,
                                   name='listBox1',
                                   parent=self.panel4,
                                   pos=wx.Point(16, 64),
                                   size=wx.Size(115, 63),
                                   style=0,
                                   validator=wx.DefaultValidator)

        self.checkListBox1 = wx.CheckListBox(choices=[],
                                             id=wxID_FRAME1CHECKLISTBOX1,
                                             name='checkListBox1',
                                             parent=self.panel4,
                                             pos=wx.Point(16, 136),
                                             size=wx.Size(115, 63),
                                             style=0,
                                             validator=wx.DefaultValidator)

        self.grid1 = wx.grid.Grid(id=wxID_FRAME1GRID1,
                                  name='grid1',
                                  parent=self.panel4,
                                  pos=wx.Point(144, 16),
                                  size=wx.Size(128, 112),
                                  style=0)

        self.listCtrl1 = wx.ListCtrl(id=wxID_FRAME1LISTCTRL1,
                                     name='listCtrl1',
                                     parent=self.panel4,
                                     pos=wx.Point(280, 16),
                                     size=wx.Size(100, 30),
                                     style=wx.LC_ICON,
                                     validator=wx.DefaultValidator)

        self.treeCtrl1 = wx.TreeCtrl(id=wxID_FRAME1TREECTRL1,
                                     name='treeCtrl1',
                                     parent=self.panel4,
                                     pos=wx.Point(280, 56),
                                     size=wx.Size(100, 80),
                                     style=wx.TR_HAS_BUTTONS,
                                     validator=wx.DefaultValidator)

        self.editableListBox1 = wx.gizmos.EditableListBox(
            id=wxID_FRAME1EDITABLELISTBOX1,
            label='editableListBox1',
            name='editableListBox1',
            parent=self.panel4,
            pos=wx.Point(152, 152),
            size=wx.Size(200, 100))

        self.panel5 = wx.Panel(id=wxID_FRAME1PANEL5,
                               name='panel5',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)
        self.panel5.SetAutoLayout(True)

        self.window2 = wx.Window(id=wxID_FRAME1WINDOW2,
                                 name='window2',
                                 parent=self.panel5,
                                 pos=wx.Point(446, 16),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window2.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window2.SetConstraints(
            LayoutAnchors(self.window2, False, True, True, False))

        self.window3 = wx.Window(id=wxID_FRAME1WINDOW3,
                                 name='window3',
                                 parent=self.panel5,
                                 pos=wx.Point(16, 299),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window3.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window3.SetConstraints(
            LayoutAnchors(self.window3, True, False, False, True))

        self.window4 = wx.Window(id=wxID_FRAME1WINDOW4,
                                 name='window4',
                                 parent=self.panel5,
                                 pos=wx.Point(446, 299),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window4.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window4.SetConstraints(
            LayoutAnchors(self.window4, False, False, True, True))

        self.window5 = wx.Window(id=wxID_FRAME1WINDOW5,
                                 name='window5',
                                 parent=self.panel5,
                                 pos=wx.Point(16, 16),
                                 size=wx.Size(40, 40),
                                 style=0)
        self.window5.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window5.SetConstraints(
            LayoutAnchors(self.window5, True, True, False, False))

        self.window6 = wx.Window(id=wxID_FRAME1WINDOW6,
                                 name='window6',
                                 parent=self.panel5,
                                 pos=wx.Point(192, 16),
                                 size=wx.Size(126, 40),
                                 style=0)
        self.window6.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window6.SetConstraints(
            LayoutAnchors(self.window6, True, True, True, False))

        self.window7 = wx.Window(id=wxID_FRAME1WINDOW7,
                                 name='window7',
                                 parent=self.panel5,
                                 pos=wx.Point(446, 120),
                                 size=wx.Size(40, 115),
                                 style=0)
        self.window7.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window7.SetConstraints(
            LayoutAnchors(self.window7, False, True, True, True))

        self.window8 = wx.Window(id=wxID_FRAME1WINDOW8,
                                 name='window8',
                                 parent=self.panel5,
                                 pos=wx.Point(192, 299),
                                 size=wx.Size(126, 40),
                                 style=0)
        self.window8.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window8.SetConstraints(
            LayoutAnchors(self.window8, True, False, True, True))

        self.window9 = wx.Window(id=wxID_FRAME1WINDOW9,
                                 name='window9',
                                 parent=self.panel5,
                                 pos=wx.Point(16, 120),
                                 size=wx.Size(40, 115),
                                 style=0)
        self.window9.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window9.SetConstraints(
            LayoutAnchors(self.window9, True, True, False, True))

        self.window10 = wx.Window(id=wxID_FRAME1WINDOW10,
                                  name='window10',
                                  parent=self.panel5,
                                  pos=wx.Point(225, 147),
                                  size=wx.Size(40, 40),
                                  style=0)
        self.window10.SetBackgroundColour(wx.Colour(128, 255, 0))
        self.window10.SetConstraints(
            LayoutAnchors(self.window10, False, False, False, False))

        self.panel6 = wx.Panel(id=wxID_FRAME1PANEL6,
                               name='panel6',
                               parent=self.notebook1,
                               pos=wx.Point(0, 0),
                               size=wx.Size(500, 357),
                               style=wx.TAB_TRAVERSAL)

        self.gauge1 = wx.Gauge(id=wxID_FRAME1GAUGE1,
                               name='gauge1',
                               parent=self.panel2,
                               pos=wx.Point(152, 88),
                               range=100,
                               size=wx.Size(136, 16),
                               style=wx.GA_SMOOTH | wx.GA_HORIZONTAL,
                               validator=wx.DefaultValidator)
        self.gauge1.SetValue(50)

        self._init_coll_toolBar1_Tools(self.toolBar1)
        self._init_coll_notebook1_Pages(self.notebook1)
Exemple #20
0
    def __init__(self, parent):
        # begin wxGlade: mainFrame.__init__
        wx.Frame.__init__(self, parent=parent)
        self.SetSize((1280, 720))

        # Menu Bar
        self.frame_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "New case", "")
        self.Bind(wx.EVT_MENU, self.onNewCase, id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "Open case", "")
        self.Bind(wx.EVT_MENU, self.onOpenCase, id=item.GetId())
        wxglade_tmp_menu.AppendSeparator()
        itemAddEvidenceBtn = wxglade_tmp_menu.Append(wx.ID_ANY,
                                                     "Add PCAP File", "")
        self.Bind(wx.EVT_MENU,
                  self.onAddEvidence,
                  id=itemAddEvidenceBtn.GetId())
        wxglade_tmp_menu.AppendSeparator()
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "Quit", "")
        self.Bind(wx.EVT_MENU, self.onQuit, id=item.GetId())
        self.frame_menubar.Append(wxglade_tmp_menu, "File")
        wxglade_tmp_menu = wx.Menu()
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "Clear GUI", "")
        self.Bind(wx.EVT_MENU, self.onClearGUI, id=item.GetId())
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "Delete Data", "")
        self.Bind(wx.EVT_MENU, self.onDeleteData, id=item.GetId())
        """item = wxglade_tmp_menu.Append(wx.ID_ANY, "Network pcap files", "")
        self.Bind(wx.EVT_MENU, self.onSelNetworkPcapFiles, id=item.GetId())"""

        self.frame_menubar.Append(wxglade_tmp_menu, "Tools")
        self.SetMenuBar(self.frame_menubar)
        # Menu Bar end

        #splitter window
        self.window_1 = wx.SplitterWindow(self, wx.ID_ANY)

        #left panel
        self.windowLeftPanel = wx.Panel(self.window_1, wx.ID_ANY)
        self.tree_ctrl_1 = wx.TreeCtrl(self.windowLeftPanel,
                                       wx.ID_ANY,
                                       style=wx.TR_HAS_BUTTONS
                                       | wx.TR_MULTIPLE)

        #right panel
        self.windowRightPanel = wx.Panel(self.window_1, wx.ID_ANY)
        self.searchBtn = wx.Button(self.windowRightPanel,
                                   id=wx.ID_ANY,
                                   label="Search",
                                   pos=wx.DefaultPosition,
                                   size=(100, -1),
                                   style=0,
                                   validator=wx.DefaultValidator)

        self.auiNotebook = wx.aui.AuiNotebook(self.windowRightPanel)
        self.paneltest = wx.Panel(self.auiNotebook, wx.ID_ANY,
                                  wx.DefaultPosition, wx.DefaultSize,
                                  wx.TAB_TRAVERSAL)

        #bind events
        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onItemSel, self.tree_ctrl_1)
        self.Bind(wx.EVT_BUTTON, self.onSearchBtn, self.searchBtn)
        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.onAuiClose,
                  self.auiNotebook)

        #properties
        self.SetTitle("Forensic Pi")
        self.tree_ctrl_1.SetBackgroundColour(wx.Colour(240, 240, 240))
        self.windowLeftPanel.SetMinSize((180, -1))
        self.windowRightPanel.SetMinSize((980, -1))
        self.window_1.SetMinimumPaneSize(20)

        #layout
        mainSizer = wx.BoxSizer(wx.VERTICAL)

        #left panel sizer
        panel1Sizer = wx.BoxSizer(wx.HORIZONTAL)
        panel1Sizer.Add(self.tree_ctrl_1, 1, wx.EXPAND, 0)
        self.windowLeftPanel.SetSizer(panel1Sizer)

        #right panel sizer
        self.panel2Sizer = wx.BoxSizer(wx.VERTICAL)
        self.panel2Sizer.Add(self.searchBtn, 0, wx.ALIGN_RIGHT, 0)
        self.panel2Sizer.Add(self.auiNotebook, 1, wx.EXPAND, 0)
        self.windowRightPanel.SetSizer(self.panel2Sizer)

        #splitter
        self.window_1.SplitVertically(self.windowLeftPanel,
                                      self.windowRightPanel)
        mainSizer.Add(self.window_1, 1, wx.EXPAND, 0)

        self.SetSizer(mainSizer)
        self.Layout()
Exemple #21
0
    def __init__(self, frame, data):
        self.data = data
        self.palette = matplotlib.cm.get_cmap("jet")
        data.register_for_updates(self.on_update)
        self.frame = frame
        self.plate_bitmap = None
        self.frame.Sizer = wx.BoxSizer(wx.VERTICAL)
        self.splitter = wx.SplitterWindow(self.frame)
        try:
            self.splitter.Bind(wx.EVT_SPLITTER_DOUBLECLICKED, self.on_splitter_dclick)
        except:
            pass
        self.frame.Sizer.Add(self.splitter, 1, wx.EXPAND)
        self.sr_panel = wx.Panel(self.splitter)
        self.sr_panel.SetInitialSize((120, -1))
        self.sr_panel.Sizer = wx.BoxSizer(wx.VERTICAL)
        self.plate_choice = wx.Choice(self.sr_panel)
        self.sr_panel.Sizer.Add(self.plate_choice, 0, wx.LEFT | wx.ALL | wx.EXPAND, 4)
        self.plate_panel = wx.Panel(self.sr_panel)
        self.sr_panel.Sizer.Add(self.plate_panel, 1, wx.EXPAND)
        rows, cols = data.plate_layout
        w, h, _, _ = self.plate_panel.GetFullTextExtent("".join(["00"] * cols))
        h *= rows
        self.plate_panel.SetInitialSize((w, h))
        self.canvas_panel = wx.Panel(self.splitter)
        self.canvas_panel.Sizer = wx.BoxSizer(wx.VERTICAL)
        control_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.canvas_panel.Sizer.Add(control_sizer, 0, wx.EXPAND | wx.ALL, 2)
        self.site_grid = wx.grid.Grid(self.canvas_panel)
        self.site_grid.SetDefaultRenderer(wx.grid.GridCellFloatRenderer())
        self.site_grid.SetDefaultEditor(wx.grid.GridCellFloatEditor())
        self.site_grid.CreateGrid(1, 2)
        self.site_grid.SetColLabelValue(0, "X")
        self.site_grid.SetColLabelValue(1, "Y")
        control_sizer.Add(
            self.site_grid, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5
        )

        self.channel_grid = wx.grid.Grid(self.canvas_panel)
        self.channel_grid.CreateGrid(1, 4)
        self.channel_grid.SetColLabelValue(0, "Red")
        self.channel_grid.SetColLabelValue(1, "Green")
        self.channel_grid.SetColLabelValue(2, "Blue")
        self.channel_grid.SetColLabelValue(3, "Alpha")
        self.channel_grid.SetDefaultEditor(wx.grid.GridCellNumberEditor())
        self.channel_grid.SetDefaultRenderer(wx.grid.GridCellNumberRenderer())
        control_sizer.Add(
            self.channel_grid, 0, wx.ALIGN_RIGHT | wx.ALIGN_TOP | wx.ALL | wx.EXPAND, 5
        )
        self.figure = matplotlib.figure.Figure()
        self.axes = self.figure.add_axes((0.05, 0.05, 0.9, 0.9))
        self.subcanvaspanel = wx.Panel(self.canvas_panel)
        self.canvas = matplotlib.backends.backend_wxagg.FigureCanvasWxAgg(
            self.subcanvaspanel, -1, self.figure
        )
        self.canvas_panel.Sizer.Add(self.subcanvaspanel, 1, wx.EXPAND)
        #
        # The following is largely taken from the matplotlib examples:
        # http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
        #
        self.navtoolbar = matplotlib.backends.backend_wx.NavigationToolbar2Wx(
            self.canvas
        )
        self.navtoolbar.Realize()
        if wx.Platform == "__WXMAC__":
            # Mac platform (OSX 10.3, MacPython) does not seem to cope with
            # having a toolbar in a sizer. This work-around gets the buttons
            # back, but at the expense of having the toolbar at the top
            self.frame.SetToolBar(self.navtoolbar)
        # update the axes menu on the toolbar
        self.navtoolbar.update()
        self.image_dict = None
        self.image_dict_lock = multiprocessing.RLock()
        self.image_dict_generation = 0
        self.splitter.SplitVertically(self.sr_panel, self.canvas_panel)
        self.plate_panel.Bind(wx.EVT_PAINT, self.on_paint_plate)
        self.plate_panel.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase_background)
        self.plate_panel.Bind(wx.EVT_SIZE, self.on_plate_size)
        self.plate_panel.Bind(wx.EVT_MOTION, self.on_plate_motion)
        self.plate_panel.Bind(wx.EVT_LEFT_DOWN, self.on_plate_click)
        self.plate_choice.Bind(wx.EVT_CHOICE, self.on_plate_choice_evt)
        self.site_grid.Bind(
            wx.grid.EVT_GRID_CELL_CHANGED, lambda event: self.update_figure()
        )
        self.channel_grid.Bind(
            wx.grid.EVT_GRID_CELL_CHANGED, lambda event: self.update_figure()
        )
        self.frame.Bind(wx.EVT_CLOSE, self.on_close)
        self.subcanvaspanel.Bind(wx.EVT_SIZE, self.on_subcanvaspanel_size)
        self.on_update()
        self.frame.Layout()
Exemple #22
0
    def __init__(self,
                 parent,
                 curvedict,
                 wrapper=None,
                 selkeys=None,
                 labels=None):
        """
        *curvedict* is a dictionary that contains the curves. Keys serve as
        identifiers in the curve selection.
        e.g.
        curvelist["#1:"] = np.array[ np.array[0.0,1], np.array[0.0,.971] ...]
        *parent* is the main frame
        *wrapper* is the object to which the chosen keys are given back. If
           it is not None, it must provide a function *OnResults*, accepting
           a list of keys as an argument.
        *selkeys* items in the list *curvedict* that are preelected.
        *labels* dictionary with same keys as *curvelist* - labels of the
           entries in the list. If none, the keys of *curvedict* will be used.        
        """
        # parent is the main frame of PyCorrFit
        self.parent = parent
        self.wrapper = wrapper
        self.curvedict = curvedict
        self.selkeys = selkeys
        self.labels = labels  # can be None
        self.curvelabels = None  # filled by self.ProcessDict()
        if self.selkeys is not None:
            newselkeys = list()
            for item in self.selkeys:
                newselkeys.append(str(item))
            self.selkeys = newselkeys
        # Get the window positioning correctly
        pos = self.parent.GetPosition()
        pos = (pos[0] + 100, pos[1] + 100)
        wx.Frame.__init__(self,
                          parent=self.parent,
                          title="Overlay curves",
                          pos=pos,
                          style=wx.DEFAULT_FRAME_STYLE
                          | wx.FRAME_FLOAT_ON_PARENT,
                          size=(800, 500))
        ## Pre-process
        self.ProcessDict()
        ## Content
        self.sp = wx.SplitterWindow(self,
                                    size=(500, 500),
                                    style=wx.SP_NOBORDER)
        self.sp.SetMinimumPaneSize(1)
        # Top panel
        panel_top = wx.Panel(self.sp, size=(500, 200))
        self.upperSizer = wx.BoxSizer(wx.VERTICAL)
        if platform.system().lower() == 'darwin':
            ctrl = "Apple"
        else:
            ctrl = "Ctrl"
        text = "By holding down the '"+ctrl+"' key, single curves can be \n" +\
               "selected or deselected. The 'Shift' key can be used \n" +\
               "to select groups."
        self.upperSizer.Add(wx.StaticText(panel_top, label=text))
        # Bottom Panel
        self.bottom_sp = wx.SplitterWindow(self.sp,
                                           size=(500, 300),
                                           style=wx.SP_NOBORDER)
        self.bottom_sp.SetMinimumPaneSize(1)
        sizepanelx = 250
        panel_bottom = wx.Panel(self.bottom_sp, size=(sizepanelx, 300))
        self.boxSizer = wx.BoxSizer(wx.VERTICAL)
        # Box selection
        style = wx.LB_EXTENDED
        self.SelectBox = wx.ListBox(panel_bottom,
                                    size=(sizepanelx, 300),
                                    style=style,
                                    choices=self.curvelabels)
        for i in np.arange(len(self.curvekeys)):
            self.SelectBox.SetSelection(i)

        # Deselect keys that are not in self.selkeys
        if self.selkeys is not None:
            for i in np.arange(len(self.curvekeys)):
                if self.selkeys.count(self.curvekeys[i]) == 0:
                    self.SelectBox.Deselect(i)
        self.Bind(wx.EVT_LISTBOX, self.OnUpdatePlot, self.SelectBox)
        self.boxSizer.Add(self.SelectBox, wx.EXPAND)
        minsx = self.boxSizer.GetMinSize()[0]
        # Button REMOVE
        btnrem = wx.Button(panel_bottom, wx.ID_ANY, 'Remove selected')
        self.Bind(wx.EVT_BUTTON, self.OnPushResultsRemove, btnrem)
        btnrem.SetMinSize((minsx, -1))
        self.boxSizer.Add(btnrem)
        # Button KEEP
        btnkep = wx.Button(panel_bottom, wx.ID_ANY, 'Keep selected')
        self.Bind(wx.EVT_BUTTON, self.OnPushResultsKeep, btnkep)
        self.boxSizer.Add(btnkep)
        btnkep.SetMinSize((minsx, -1))
        # Button CANCEL
        btncancel = wx.Button(panel_bottom, wx.ID_ANY, 'Cancel')
        self.Bind(wx.EVT_BUTTON, self.OnCancel, btncancel)
        self.boxSizer.Add(btncancel)
        btncancel.SetMinSize((minsx, -1))
        # Finish off sizers
        panel_top.SetSizer(self.upperSizer)
        panel_bottom.SetSizer(self.boxSizer)
        self.upperSizer.Fit(panel_top)
        self.boxSizer.Fit(panel_bottom)
        minsize = np.array(self.boxSizer.GetMinSizeTuple()) +\
                  np.array(self.upperSizer.GetMinSizeTuple()) +\
                  np.array((300,30))
        self.SetMinSize(minsize)
        #self.SetSize(minsize)
        #self.SetMaxSize((9999, self.boxSizer.GetMinSizeTuple()[1]))
        # Canvas
        self.canvas = plot.PlotCanvas(self.bottom_sp)
        self.canvas.setLogScale((True, False))
        self.canvas.SetEnableZoom(True)
        # Splitter window
        self.bottom_sp.SplitVertically(panel_bottom, self.canvas, sizepanelx)
        sizetoppanel = self.upperSizer.GetMinSizeTuple()[1]
        self.sp.SplitHorizontally(panel_top, self.bottom_sp, sizetoppanel)
        self.OnUpdatePlot()
        # Icon
        if parent.MainIcon is not None:
            wx.Frame.SetIcon(self, parent.MainIcon)
        self.Show(True)
    def __init__(self, parent, config):
        # Settting the GUI size and panels design
        displays = (wx.Display(i) for i in range(wx.Display.GetCount())
                    )  # Gets the number of displays
        screenSizes = [
            display.GetGeometry().GetSize() for display in displays
        ]  # Gets the size of each display
        index = 0  # For display 1.
        screenWidth = screenSizes[index][0]
        screenHeight = screenSizes[index][1]
        self.gui_size = (screenWidth * 0.7, screenHeight * 0.85)

        wx.Frame.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          title='DeepLabCut2.0 - Manual Frame Extraction',
                          size=wx.Size(self.gui_size),
                          pos=wx.DefaultPosition,
                          style=wx.RESIZE_BORDER | wx.DEFAULT_FRAME_STYLE
                          | wx.TAB_TRAVERSAL)
        self.statusbar = self.CreateStatusBar()
        self.statusbar.SetStatusText("")

        self.SetSizeHints(
            wx.Size(self.gui_size)
        )  #  This sets the minimum size of the GUI. It can scale now!

        ###################################################################################################################################################
        # Spliting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting!
        topSplitter = wx.SplitterWindow(self)

        self.image_panel = ImagePanel(topSplitter, config, self.gui_size)
        self.widget_panel = WidgetPanel(topSplitter)

        topSplitter.SplitHorizontally(self.image_panel,
                                      self.widget_panel,
                                      sashPosition=self.gui_size[1] *
                                      0.83)  #0.9
        topSplitter.SetSashGravity(1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(topSplitter, 1, wx.EXPAND)
        self.SetSizer(sizer)

        ###################################################################################################################################################
        # Add Buttons to the WidgetPanel and bind them to their respective functions.

        widgetsizer = wx.WrapSizer(orient=wx.HORIZONTAL)

        self.load = wx.Button(self.widget_panel,
                              id=wx.ID_ANY,
                              label="Load Video")
        widgetsizer.Add(self.load, 1, wx.ALL, 15)
        self.load.Bind(wx.EVT_BUTTON, self.browseDir)

        self.help = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Help")
        widgetsizer.Add(self.help, 1, wx.ALL, 15)
        self.help.Bind(wx.EVT_BUTTON, self.helpButton)

        self.grab = wx.Button(self.widget_panel,
                              id=wx.ID_ANY,
                              label="Grab Frames")
        widgetsizer.Add(self.grab, 1, wx.ALL, 15)
        self.grab.Bind(wx.EVT_BUTTON, self.grabFrame)
        self.grab.Enable(False)

        widgetsizer.AddStretchSpacer(5)
        self.slider = wx.Slider(self.widget_panel,
                                id=wx.ID_ANY,
                                value=0,
                                minValue=0,
                                maxValue=1,
                                size=(200, -1),
                                style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS
                                | wx.SL_LABELS)
        widgetsizer.Add(self.slider, 1, wx.ALL, 5)
        self.slider.Hide()

        widgetsizer.AddStretchSpacer(5)
        self.start_frames_sizer = wx.BoxSizer(wx.VERTICAL)
        self.end_frames_sizer = wx.BoxSizer(wx.VERTICAL)

        self.start_frames_sizer.AddSpacer(15)
        self.startFrame = wx.SpinCtrl(self.widget_panel,
                                      value='0',
                                      size=(100, -1),
                                      min=0,
                                      max=120)
        self.startFrame.Bind(wx.EVT_SPINCTRL, self.updateSlider)
        self.startFrame.Enable(False)
        self.start_frames_sizer.Add(self.startFrame, 1,
                                    wx.EXPAND | wx.ALIGN_LEFT, 15)
        start_text = wx.StaticText(self.widget_panel,
                                   label='Start Frame Index')
        self.start_frames_sizer.Add(start_text, 1, wx.EXPAND | wx.ALIGN_LEFT,
                                    15)
        self.checkBox = wx.CheckBox(self.widget_panel,
                                    id=wx.ID_ANY,
                                    label='Range of frames')
        self.checkBox.Bind(wx.EVT_CHECKBOX, self.activate_frame_range)
        self.start_frames_sizer.Add(self.checkBox, 1,
                                    wx.EXPAND | wx.ALIGN_LEFT, 15)
        #
        self.end_frames_sizer.AddSpacer(15)
        self.endFrame = wx.SpinCtrl(self.widget_panel,
                                    value='1',
                                    size=(160, -1),
                                    min=1,
                                    max=120)
        self.endFrame.Enable(False)
        self.end_frames_sizer.Add(self.endFrame, 1, wx.EXPAND | wx.ALIGN_LEFT,
                                  15)
        end_text = wx.StaticText(self.widget_panel, label='Number of Frames')
        self.end_frames_sizer.Add(end_text, 1, wx.EXPAND | wx.ALIGN_LEFT, 15)
        self.updateFrame = wx.Button(self.widget_panel,
                                     id=wx.ID_ANY,
                                     label="Update")
        self.end_frames_sizer.Add(self.updateFrame, 1,
                                  wx.EXPAND | wx.ALIGN_LEFT, 15)
        self.updateFrame.Bind(wx.EVT_BUTTON, self.updateSlider)
        self.updateFrame.Enable(False)

        widgetsizer.Add(self.start_frames_sizer, 1, wx.ALL, 0)
        widgetsizer.AddStretchSpacer(5)
        widgetsizer.Add(self.end_frames_sizer, 1, wx.ALL, 0)
        widgetsizer.AddStretchSpacer(15)

        self.quit = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Quit")
        widgetsizer.Add(self.quit, 1, wx.ALL, 15)
        self.quit.Bind(wx.EVT_BUTTON, self.quitButton)
        self.quit.Enable(True)

        # Hiding these widgets and show them once the video is loaded
        self.start_frames_sizer.ShowItems(show=False)
        self.end_frames_sizer.ShowItems(show=False)

        self.widget_panel.SetSizer(widgetsizer)
        self.widget_panel.SetSizerAndFit(widgetsizer)
        self.widget_panel.Layout()

        # Variables initialization
        self.numberFrames = 0
        self.currFrame = 0
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.drs = []
        self.cfg = auxiliaryfunctions.read_config(config)
        self.Task = self.cfg['Task']
        self.start = self.cfg['start']
        self.stop = self.cfg['stop']
        self.date = self.cfg['date']
        self.trainFraction = self.cfg['TrainingFraction']
        self.trainFraction = self.trainFraction[0]
        self.videos = self.cfg['video_sets'].keys()
        self.bodyparts = self.cfg['bodyparts']
        self.colormap = plt.get_cmap(self.cfg['colormap'])
        self.colormap = self.colormap.reversed()
        self.markerSize = self.cfg['dotsize']
        self.alpha = self.cfg['alphavalue']
        self.video_names = [Path(i).stem for i in self.videos]
        self.config_path = Path(config)
        self.extract_range_frame = False
        self.extract_from_analyse_video = False
    def Size(self, evt):
        self.SetSize(self.parent.Size)


if __name__ == '__main__':
    app = wx.App(redirect=False)
    frm = wx.Frame(None,
                   title="wxPython - wx.StyledTextCtrl - Document Map Demo",
                   pos=(0, 0),
                   size=(500, 1024))

    # pnl = wx.Panel(frm, -1)
    # dcm = DocumentMap(pnl)

    spl = wx.SplitterWindow(frm)
    pn1 = wx.Panel(spl)
    pn2 = wx.Panel(spl)
    spl.SplitVertically(pn1, pn2, -200)

    doc = DocumentEditor(pn1)
    #TODO,
    dcm = DocumentMap(
        pn2,
        doc)  #, style=Styling)  # 3rd parm: styling function, default: None??

    # import wx.lib.mixins.inspection as inspection
    # wx.lib.inspection.InspectionTool().Show(selectObj=dcm, refreshTree=True)

    frm.Show()
    app.MainLoop()
    def __init__(self, parent,config,video,shuffle,Dataframe,scorer,savelabeled):
# Settting the GUI size and panels design
        displays = (wx.Display(i) for i in range(wx.Display.GetCount())) # Gets the number of displays
        screenSizes = [display.GetGeometry().GetSize() for display in displays] # Gets the size of each display
        index = 0 # For display 1.
        screenWidth = screenSizes[index][0]
        screenHeight = screenSizes[index][1]
        self.gui_size = (screenWidth*0.7,screenHeight*0.85)

        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = 'DeepLabCut2.0 - Manual Outlier Frame Extraction',
                            size = wx.Size(self.gui_size), pos = wx.DefaultPosition, style = wx.RESIZE_BORDER|wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        self.statusbar = self.CreateStatusBar()
        self.statusbar.SetStatusText("")

        self.SetSizeHints(wx.Size(self.gui_size)) #  This sets the minimum size of the GUI. It can scale now!
        
###################################################################################################################################################
# Spliting the frame into top and bottom panels. Bottom panels contains the widgets. The top panel is for showing images and plotting!
        topSplitter = wx.SplitterWindow(self)

        self.image_panel = ImagePanel(topSplitter, config,video,shuffle,Dataframe,self.gui_size)
        self.widget_panel = WidgetPanel(topSplitter)
        
        topSplitter.SplitHorizontally(self.image_panel, self.widget_panel,sashPosition=self.gui_size[1]*0.83)#0.9
        topSplitter.SetSashGravity(1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(topSplitter, 1, wx.EXPAND)
        self.SetSizer(sizer)

###################################################################################################################################################
# Add Buttons to the WidgetPanel and bind them to their respective functions.

        widgetsizer = wx.WrapSizer(orient=wx.HORIZONTAL)
        
        self.load_button_sizer = wx.BoxSizer(wx.VERTICAL)
        self.help_button_sizer = wx.BoxSizer(wx.VERTICAL)
        
        self.help = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Help")
        self.help_button_sizer.Add(self.help , 1, wx.ALL, 15)
#        widgetsizer.Add(self.help , 1, wx.ALL, 15)
        self.help.Bind(wx.EVT_BUTTON, self.helpButton)

        widgetsizer.Add(self.help_button_sizer,1,wx.ALL,0)
        
        self.grab = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Grab Frames")
        widgetsizer.Add(self.grab , 1, wx.ALL, 15)
        self.grab.Bind(wx.EVT_BUTTON, self.grabFrame)
        self.grab.Enable(True)

        widgetsizer.AddStretchSpacer(5)
        self.slider = wx.Slider(self.widget_panel, id=wx.ID_ANY, value = 0, minValue=0, maxValue=1,size=(200, -1), style=wx.SL_HORIZONTAL | wx.SL_AUTOTICKS | wx.SL_LABELS )
        widgetsizer.Add(self.slider,1, wx.ALL,5)
        self.slider.Bind(wx.EVT_SLIDER, self.OnSliderScroll)
        
        widgetsizer.AddStretchSpacer(5)
        self.start_frames_sizer = wx.BoxSizer(wx.VERTICAL)
        self.end_frames_sizer = wx.BoxSizer(wx.VERTICAL)

        self.start_frames_sizer.AddSpacer(15)
#        self.startFrame = wx.SpinCtrl(self.widget_panel, value='0', size=(100, -1), min=0, max=120)
        self.startFrame = wx.SpinCtrl(self.widget_panel, value='0', size=(100, -1))#,style=wx.SP_VERTICAL)
        self.startFrame.Enable(False)
        self.start_frames_sizer.Add(self.startFrame,1, wx.EXPAND|wx.ALIGN_LEFT,15)
        start_text = wx.StaticText(self.widget_panel, label='Start Frame Index')
        self.start_frames_sizer.Add(start_text,1, wx.EXPAND|wx.ALIGN_LEFT,15)
        self.checkBox = wx.CheckBox(self.widget_panel, id=wx.ID_ANY,label = 'Range of frames')
        self.checkBox.Bind(wx.EVT_CHECKBOX,self.activate_frame_range)
        self.start_frames_sizer.Add(self.checkBox,1, wx.EXPAND|wx.ALIGN_LEFT,15)
#        
        self.end_frames_sizer.AddSpacer(15)
        self.endFrame = wx.SpinCtrl(self.widget_panel, value='1', size=(160, -1))#, min=1, max=120)
        self.endFrame.Enable(False)
        self.end_frames_sizer.Add(self.endFrame,1, wx.EXPAND|wx.ALIGN_LEFT,15)
        end_text = wx.StaticText(self.widget_panel, label='Number of Frames')
        self.end_frames_sizer.Add(end_text,1, wx.EXPAND|wx.ALIGN_LEFT,15)
        self.updateFrame = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Update")
        self.end_frames_sizer.Add(self.updateFrame,1, wx.EXPAND|wx.ALIGN_LEFT,15)
        self.updateFrame.Bind(wx.EVT_BUTTON, self.updateSlider)
        self.updateFrame.Enable(False)
        
        widgetsizer.Add(self.start_frames_sizer,1,wx.ALL,0)
        widgetsizer.AddStretchSpacer(5)
        widgetsizer.Add(self.end_frames_sizer,1,wx.ALL,0)
        widgetsizer.AddStretchSpacer(15)
        
        self.quit = wx.Button(self.widget_panel, id=wx.ID_ANY, label="Quit")
        widgetsizer.Add(self.quit , 1, wx.ALL, 15)
        self.quit.Bind(wx.EVT_BUTTON, self.quitButton)
        self.quit.Enable(True)

        self.widget_panel.SetSizer(widgetsizer)
        self.widget_panel.SetSizerAndFit(widgetsizer)
        
        
# Variables initialization
        self.numberFrames = 0
        self.currFrame = 0
        self.figure = Figure()
        self.axes = self.figure.add_subplot(111)
        self.drs = []
        self.extract_range_frame = False
        self.firstFrame  = 0
        # self.cropping = False

# Read confing file
        self.cfg = auxiliaryfunctions.read_config(config)
        self.Task = self.cfg['Task']
        self.start = self.cfg['start']
        self.stop = self.cfg['stop']
        self.date = self.cfg['date']
        self.trainFraction = self.cfg['TrainingFraction']
        self.trainFraction = self.trainFraction[0]
        self.videos = self.cfg['video_sets'].keys()
        self.bodyparts = self.cfg['bodyparts']
        self.colormap = plt.get_cmap(self.cfg['colormap'])
        self.colormap = self.colormap.reversed()
        self.markerSize = self.cfg['dotsize']
        self.alpha = self.cfg['alphavalue']
        self.iterationindex=self.cfg['iteration']
        self.cropping = self.cfg['cropping']
        self.video_names = [Path(i).stem for i in self.videos]
        self.config_path = Path(config)
        self.video_source = Path(video).resolve()
        self.shuffle = shuffle
        self.Dataframe = Dataframe
        self.scorer = scorer
        self.savelabeled = savelabeled
        
# Read the video file
        self.vid = cv2.VideoCapture(str(self.video_source))
        self.videoPath = os.path.dirname(self.video_source)
        self.filename = Path(self.video_source).name
        self.numberFrames = int(self.vid.get(cv2.CAP_PROP_FRAME_COUNT))
        self.strwidth = int(np.ceil(np.log10(self.numberFrames)))
# Set the values of slider and range of frames
        self.startFrame.SetMax(self.numberFrames-1)
        self.slider.SetMax(self.numberFrames-1)
        self.endFrame.SetMax(self.numberFrames-1)
        self.startFrame.Bind(wx.EVT_SPINCTRL,self.updateSlider)#wx.EVT_SPIN
# Set the status bar
        self.statusbar.SetStatusText('Working on video: {}'.format(os.path.split(str(self.video_source))[-1]))
# Adding the video file to the config file.
        if  not (str(self.video_source.stem) in self.video_names) :
            add.add_new_videos(self.config_path,[self.video_source])

        self.filename = Path(self.video_source).name
        self.update()
        self.plot_labels()
        self.widget_panel.Layout()
    def _init_ctrls(self, prnt):
        wx.SplitterWindow.__init__(self,
                                   id=ID_EDITINGPANEL,
                                   name='MainSplitter',
                                   parent=prnt,
                                   point=wx.Point(0, 0),
                                   size=wx.Size(-1, -1),
                                   style=wx.SP_3D)
        self._init_utils()

        self.PartList = wx.ListBox(choices=[],
                                   id=ID_EDITINGPANELPARTLIST,
                                   name='PartList',
                                   parent=self,
                                   pos=wx.Point(0, 0),
                                   size=wx.Size(-1, -1),
                                   style=0)
        self.PartList.Bind(wx.EVT_LISTBOX,
                           self.OnPartListBoxClick,
                           id=ID_EDITINGPANELPARTLIST)

        self.SecondSplitter = wx.SplitterWindow(
            id=ID_EDITINGPANELSECONDSPLITTER,
            name='SecondSplitter',
            parent=self,
            point=wx.Point(0, 0),
            size=wx.Size(-1, -1),
            style=wx.SP_3D)
        self.SplitHorizontally(self.PartList, self.SecondSplitter, 110)
        self.SetMinimumPaneSize(1)

        self.SubindexGridPanel = wx.Panel(id=ID_EDITINGPANELSUBINDEXGRIDPANEL,
                                          name='SubindexGridPanel',
                                          parent=self.SecondSplitter,
                                          pos=wx.Point(0, 0),
                                          size=wx.Size(-1, -1),
                                          style=wx.TAB_TRAVERSAL)

        self.IndexListPanel = wx.Panel(id=ID_EDITINGPANELINDEXLISTPANEL,
                                       name='IndexListPanel',
                                       parent=self.SecondSplitter,
                                       pos=wx.Point(0, 0),
                                       size=wx.Size(-1, -1),
                                       style=wx.TAB_TRAVERSAL)
        self.SecondSplitter.SplitVertically(self.IndexListPanel,
                                            self.SubindexGridPanel, 280)
        self.SecondSplitter.SetMinimumPaneSize(1)

        self.SubindexGrid = wx.grid.Grid(id=ID_EDITINGPANELSUBINDEXGRID,
                                         name='SubindexGrid',
                                         parent=self.SubindexGridPanel,
                                         pos=wx.Point(0, 0),
                                         size=wx.Size(-1, -1),
                                         style=0)
        self.SubindexGrid.SetFont(
            wx.Font(12, 77, wx.NORMAL, wx.NORMAL, False, 'Sans'))
        self.SubindexGrid.SetLabelFont(
            wx.Font(10, 77, wx.NORMAL, wx.NORMAL, False, 'Sans'))
        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
                               self.OnSubindexGridCellChange)
        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_RIGHT_CLICK,
                               self.OnSubindexGridRightClick)
        self.SubindexGrid.Bind(wx.grid.EVT_GRID_SELECT_CELL,
                               self.OnSubindexGridSelectCell)
        self.SubindexGrid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK,
                               self.OnSubindexGridCellLeftClick)
        self.SubindexGrid.Bind(wx.grid.EVT_GRID_EDITOR_SHOWN,
                               self.OnSubindexGridEditorShown)

        self.CallbackCheck = wx.CheckBox(id=ID_EDITINGPANELCALLBACKCHECK,
                                         label=_('Have Callbacks'),
                                         name='CallbackCheck',
                                         parent=self.SubindexGridPanel,
                                         pos=wx.Point(0, 0),
                                         size=wx.Size(152, 24),
                                         style=0)
        self.CallbackCheck.Bind(wx.EVT_CHECKBOX,
                                self.OnCallbackCheck,
                                id=ID_EDITINGPANELCALLBACKCHECK)

        self.IndexList = wx.ListBox(choices=[],
                                    id=ID_EDITINGPANELINDEXLIST,
                                    name='IndexList',
                                    parent=self.IndexListPanel,
                                    pos=wx.Point(0, 0),
                                    size=wx.Size(-1, -1),
                                    style=0)
        self.IndexList.Bind(wx.EVT_LISTBOX,
                            self.OnIndexListClick,
                            id=ID_EDITINGPANELINDEXLIST)
        self.IndexList.Bind(wx.EVT_RIGHT_UP, self.OnIndexListRightUp)

        self.AddButton = wx.Button(id=ID_EDITINGPANELADDBUTTON,
                                   label=_('Add'),
                                   name='AddButton',
                                   parent=self.IndexListPanel,
                                   pos=wx.Point(0, 0),
                                   size=wx.DefaultSize,
                                   style=0)
        self.AddButton.Bind(wx.EVT_BUTTON,
                            self.OnAddButtonClick,
                            id=ID_EDITINGPANELADDBUTTON)

        self.IndexChoice = wx.ComboBox(choices=[],
                                       id=ID_EDITINGPANELINDEXCHOICE,
                                       name='IndexChoice',
                                       parent=self.IndexListPanel,
                                       pos=wx.Point(50, 0),
                                       size=wx.Size(-1, 30),
                                       style=wx.CB_READONLY)

        self._init_sizers()
Exemple #27
0
    def __init__(self, parent, set_dir=None):
        """
        Default class constructor.

        :param wx.Window `parent`: parent window.
        :param string `set_dir`: path to set as working directory

        """
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           _("Image Browser"),
                           wx.DefaultPosition, (400, 400),
                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.set_dir = os.getcwd()
        self.set_file = None

        if set_dir is not None:
            if os.path.exists(
                    set_dir):  # set to working directory if nothing set
                self.set_dir = set_dir

        vbox_top = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(vbox_top)

        hbox_loc = wx.BoxSizer(wx.HORIZONTAL)
        vbox_top.Add(hbox_loc, 0, wx.GROW | wx.ALIGN_LEFT | wx.ALL, 0)

        loc_label = wx.StaticText(self, -1, "Folder:")
        hbox_loc.Add(
            loc_label, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL
            | wx.ADJUST_MINSIZE, 5)

        self.dir = wx.TextCtrl(self,
                               -1,
                               self.set_dir,
                               style=wx.TE_RICH | wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.OnDirectoryTextSet, self.dir)
        hbox_loc.Add(self.dir, 1, wx.GROW | wx.ALIGN_LEFT | wx.ALL, 5)

        up_bmp = wx.ArtProvider.GetBitmap(wx.ART_GO_DIR_UP, wx.ART_BUTTON,
                                          (16, 16))
        btn = BitmapButton(self, -1, up_bmp, style=wx.BU_EXACTFIT)
        btn.SetHelpText(_("Up one level"))
        btn.SetToolTip(_("Up one level"))
        self.Bind(wx.EVT_BUTTON, self.OnUpDirectory, btn)
        hbox_loc.Add(btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        folder_bmp = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN,
                                              wx.ART_BUTTON, (16, 16))
        btn = BitmapButton(self, -1, folder_bmp, style=wx.BU_EXACTFIT)
        btn.SetHelpText(_("Browse for a &folder..."))
        btn.SetToolTip(_("Browse for a folder..."))
        self.Bind(wx.EVT_BUTTON, self.OnChooseDirectory, btn)
        hbox_loc.Add(btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5)

        hbox_nav = wx.BoxSizer(wx.HORIZONTAL)
        vbox_top.Add(hbox_nav, 0, wx.ALIGN_LEFT | wx.ALL, 0)

        label = wx.StaticText(self, -1, "Files of type:")
        hbox_nav.Add(label, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)

        self.fl_ext = '*.bmp'  # initial setting for file filtering
        self.GetFiles()  # get the file list

        self.fl_ext_types = (
            # display, filter
            ("All supported formats", "All"),
            ("BMP (*.bmp)", "*.bmp"),
            ("GIF (*.gif)", "*.gif"),
            ("PNG (*.png)", "*.png"),
            ("JPEG (*.jpg)", "*.jpg"),
            ("ICO (*.ico)", "*.ico"),
            ("PNM (*.pnm)", "*.pnm"),
            ("PCX (*.pcx)", "*.pcx"),
            ("TIFF (*.tif)", "*.tif"),
            ("All Files", "*.*"),
        )
        self.set_type, self.fl_ext = self.fl_ext_types[
            0]  # initial file filter setting
        self.fl_types = [x[0] for x in self.fl_ext_types]
        self.sel_type = wx.ComboBox(self, -1, self.set_type,
                                    wx.DefaultPosition, wx.DefaultSize,
                                    self.fl_types, wx.CB_DROPDOWN)
        # after this we don't care about the order any more
        self.fl_ext_types = dict(self.fl_ext_types)

        self.Bind(wx.EVT_COMBOBOX, self.OnSetType, self.sel_type)
        hbox_nav.Add(self.sel_type, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        splitter = wx.SplitterWindow(self, -1, wx.DefaultPosition,
                                     wx.Size(100, 100), 0)
        splitter.SetMinimumPaneSize(100)

        split_left = wx.Panel(splitter, -1, wx.DefaultPosition, wx.DefaultSize,
                              wx.NO_BORDER | wx.TAB_TRAVERSAL)
        vbox_left = wx.BoxSizer(wx.VERTICAL)
        split_left.SetSizer(vbox_left)

        self.tb = tb = wx.ListBox(split_left, -1, wx.DefaultPosition,
                                  wx.DefaultSize, self.fl_list, wx.LB_SINGLE)
        self.Bind(wx.EVT_LISTBOX, self.OnListClick, tb)
        self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnListDClick, tb)
        vbox_left.Add(self.tb, 1, wx.GROW | wx.ALL, 0)

        width, height = self.tb.GetSize()

        split_right = wx.Panel(splitter, -1, wx.DefaultPosition,
                               wx.DefaultSize, wx.NO_BORDER | wx.TAB_TRAVERSAL)
        vbox_right = wx.BoxSizer(wx.VERTICAL)
        split_right.SetSizer(vbox_right)

        self.image_view = ImagePanel(split_right)
        vbox_right.Add(self.image_view, 1, wx.GROW | wx.ALL, 0)

        splitter.SplitVertically(split_left, split_right, 150)
        vbox_top.Add(splitter, 1, wx.GROW | wx.ALL, 5)

        hbox_btns = wx.BoxSizer(wx.HORIZONTAL)
        vbox_top.Add(hbox_btns, 0, wx.ALIGN_RIGHT | wx.ALL, 5)

        ok_btn = wx.Button(self, wx.ID_OPEN, "", wx.DefaultPosition,
                           wx.DefaultSize, 0)
        self.Bind(wx.EVT_BUTTON, self.OnOk, ok_btn)
        #ok_btn.SetDefault()
        hbox_btns.Add(ok_btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        cancel_btn = wx.Button(self, wx.ID_CANCEL, "", wx.DefaultPosition,
                               wx.DefaultSize, 0)
        hbox_btns.Add(cancel_btn, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5)

        self.ResetFiles()
    def __init__(self, parent):
        #stl = (wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE) & ~( wx.RESIZE_BORDER|wx.RESIZE_BOX|wx.MAXIMIZE_BOX)
        stl = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title=app_name,
                          pos=wx.DefaultPosition,
                          size=wx.Size(900, 500),
                          style=stl)
        wx.Frame.CenterOnScreen(self)
        #self.SetSize((wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X),wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) -70 ))
        #self.ShowFullScreen(True)
        #self.SetMinSize(self.GetSize())

        self.fileName, self.dirName = "", ""
        self.doc_name = ""
        self.t = None  # ultilisé pour le lecture des shapes
        self.doc_loaded = False
        self.use_grid = False
        self.current_tab = 0
        self.outil_active = [
            "", "", ""
        ]  # pour l'affichage de l'outil active dans la barre de status
        self.stb_spacing = 0
        self.reglage = Reglage(parent=self, title="Réglages")

        self.menubar1 = wx.MenuBar()
        self.menu1 = wx.Menu()
        self.menubar1.Append(self.menu1, u"Fichier")

        self.ouvrir_item = wx.MenuItem(self.menu1, 1, u"Ouvrir\tCtrl+O",
                                       wx.EmptyString, wx.ITEM_NORMAL)

        self.menu1.AppendItem(self.ouvrir_item)
        self.Bind(wx.EVT_MENU, self.OnFileOpen, self.ouvrir_item)

        self.menu1.AppendSeparator()

        self.enregistrer_item = wx.MenuItem(self.menu1, 2,
                                            u"Enregistrer\tCtrl+S",
                                            wx.EmptyString, wx.ITEM_NORMAL)
        self.menu1.AppendItem(self.enregistrer_item)
        self.enregistrer_item.Enable(False)
        self.Bind(wx.EVT_MENU, self.OnSave, self.enregistrer_item)

        self.enregistrer_sous_item = wx.MenuItem(
            self.menu1, 3, u"Enregistrer Sous\tShift+Ctrl+S", wx.EmptyString,
            wx.ITEM_NORMAL)
        self.menu1.AppendItem(self.enregistrer_sous_item)
        self.enregistrer_sous_item.Enable(False)
        self.Bind(wx.EVT_MENU, self.OnSaveAs, self.enregistrer_sous_item)

        self.reglage_item = wx.MenuItem(self.menu1, 4, u"Réglages\tCtrl+R",
                                        wx.EmptyString, wx.ITEM_NORMAL)
        self.menu1.AppendItem(self.reglage_item)
        self.reglage_item.Enable(False)
        self.Bind(wx.EVT_MENU, self.OnReglage, self.reglage_item)

        self.menu1.AppendSeparator()

        self.quitter_item = wx.MenuItem(self.menu1, 5, u"Quitter\tCtrl+Q")
        self.quitter_item.SetBitmap(wx.Bitmap('exit2.png'))
        self.menu1.AppendItem(self.quitter_item)

        self.Bind(wx.EVT_MENU, self.OnQuit, self.quitter_item)

        # 2eme menu : view menu
        view_menu = wx.Menu()
        self.menubar1.Append(view_menu, u"Affichage")
        self.voir_tbar = wx.MenuItem(view_menu, wx.ID_ANY,
                                     u"Voir La barre d'outil\tShift+Ctrl+T",
                                     wx.EmptyString, wx.ITEM_CHECK)
        self.voir_stbar = wx.MenuItem(
            view_menu, wx.ID_ANY, u"Voir La barre de status\tShift+Ctrl+S",
            wx.EmptyString, wx.ITEM_CHECK)

        view_menu.AppendItem(self.voir_tbar)
        view_menu.AppendItem(self.voir_stbar)

        view_menu.Check(self.voir_tbar.GetId(), True)
        view_menu.Check(self.voir_stbar.GetId(), True)

        self.Bind(wx.EVT_MENU, self.ApparenceToolBar, self.voir_tbar)
        self.Bind(wx.EVT_MENU, self.ApparenceStatusBar, self.voir_stbar)
        """
		self.outils_menu = wx.Menu()
		self.menubar1.Append( self.outils_menu, u"Outils" )
		self.vue_initiale_item = wx.MenuItem( self.outils_menu, wx.ID_ANY, u"Vue Initiale",wx.EmptyString)
		self.outils_menu.AppendItem(self.vue_initiale_item)
		self.Bind(wx.EVT_MENU,self.OnHome, self.vue_initiale_item)
		"""

        #self.grid_item = wx.MenuItem( self.option_menu, wx.ID_ANY, u"Show Grid",wx.EmptyString, wx.ITEM_CHECK)
        #self.option_menu.AppendItem(self.grid_item)
        #self.Bind(wx.EVT_MENU,self.OnShowGrid, self.grid_item)

        self.aide_menu = wx.Menu()
        self.menubar1.Append(self.aide_menu, u"Aide")
        self.aide_item = wx.MenuItem(self.aide_menu, wx.ID_ANY, u"Aide\tF1")
        self.aide_menu.AppendItem(self.aide_item)
        self.Bind(wx.EVT_MENU, self.OnAide, self.aide_item)

        self.short_cut_item = wx.MenuItem(self.aide_menu, wx.ID_ANY,
                                          u"Raccourcis Clavier\tF2")
        self.aide_menu.AppendItem(self.short_cut_item)
        self.Bind(wx.EVT_MENU, self.OnShowShortCut, self.short_cut_item)

        self.aide_menu.AppendSeparator()

        self.about_item = wx.MenuItem(self.aide_menu, wx.ID_ANY,
                                      u"À propos\tF3")
        self.aide_menu.AppendItem(self.about_item)
        self.Bind(wx.EVT_MENU, self.OnAbout, self.about_item)
        self.SetMenuBar(self.menubar1)
        self.toolbar = self.CreateToolBar(style=wx.BORDER | wx.TB_HORIZONTAL
                                          | wx.TB_FLAT)  #|wx.TB_TEXT)
        self.toolbar.SetBackgroundColour(
            "white")  #wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENUBAR))
        self.toolbar.SetToolBitmapSize((32, 32))

        ouvrir_tool = self.toolbar.AddLabelTool(2,
                                                'Ouvrir',
                                                wx.Bitmap('document_open.png'),
                                                shortHelp="Ouvrir")
        self.toolbar.AddSeparator()
        enreg_tool = self.toolbar.AddLabelTool(3,
                                               'Enregistrer',
                                               wx.Bitmap('save.png'),
                                               shortHelp="Enregistrer")
        enreg_sous_tool = self.toolbar.AddLabelTool(
            4,
            'Enregistrer Sous',
            wx.Bitmap('save_as5.png'),
            shortHelp="Enregistrer Sous")
        reglage_tool = self.toolbar.AddLabelTool(77,
                                                 u'Réglages',
                                                 wx.Bitmap('reglage2.png'),
                                                 shortHelp=u"Réglages")
        self.toolbar.AddSeparator()
        quit_tool = self.toolbar.AddLabelTool(1,
                                              'Quitter',
                                              wx.Bitmap('exit.png'),
                                              shortHelp="Quitter")

        self.toolbar.AddSeparator()

        home_tool = self.toolbar.AddLabelTool(
            5,
            'Home',
            wx.Bitmap('home.png'),
            shortHelp=
            "Vue Initial : Annuler toutes les actions appliqué sur la figure")
        export_image_tool = self.toolbar.AddLabelTool(
            10,
            'Export',
            wx.Bitmap('Image.png'),
            shortHelp="Exporter :\nExporter la figure sous forme d'image"
        )  #'export_as_image2.png' , 'childish_Image.png'
        undo_tool = self.toolbar.AddLabelTool(
            6,
            'Undo',
            wx.Bitmap('prev.png'),
            shortHelp="Annuler :\nAnnuler une à une vos actions")
        redo_tool = self.toolbar.AddLabelTool(
            7,
            'Redo',
            wx.Bitmap('next.png'),
            shortHelp="Rétablir :\nRefaire une à une vos actions annulées")
        self.toolbar.AddSeparator()
        pan_tool = self.toolbar.AddLabelTool(
            9,
            'Pan',
            wx.Bitmap('hand_tool.png'),
            shortHelp=
            "Déplacer :\nFaire déplacer la figure présente dans le canevas de dessin "
        )
        zoom_tool = self.toolbar.AddLabelTool(
            8,
            'Zoom',
            wx.Bitmap('zoom_in3.png'),
            shortHelp=
            "Zoomer :\nCréer un rectangle de zoom en cliquant droit sur une place de la vue Graphique et tirant la souris jusqu’au sommet opposé du rectangle désiré"
        )

        #self.rect_selection_tool = self.toolbar.AddLabelTool(11,'Rectangle_Selection', wx.Bitmap('selection-resize.png'), shortHelp="Selection")
        self.rect_selection_tool = self.toolbar.AddLabelTool(
            11,
            'Rectangle_Selection',
            wx.Bitmap('selection-resize.png'),
            shortHelp=
            "Sélectionner :\nPour selectionner un morceu de la carte, en maintenant le bouton gauche de la souris enfoncé, déplacez le curseur jusqu’au coin opposé "
        )

        self.toolbar.EnableTool(3, False)
        self.toolbar.EnableTool(4, False)
        self.toolbar.EnableTool(5, False)
        self.toolbar.EnableTool(6, False)
        self.toolbar.EnableTool(7, False)
        self.toolbar.EnableTool(8, False)
        self.toolbar.EnableTool(9, False)
        self.toolbar.EnableTool(10, False)
        self.toolbar.EnableTool(11, False)
        self.toolbar.EnableTool(77, False)

        self.toolbar.Realize()
        self.toolbar.Bind(wx.EVT_TOOL, self.OnQuit, quit_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnFileOpen, ouvrir_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnSave, enreg_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnSaveAs, enreg_sous_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnReglage, reglage_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnUndo, undo_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnRedo, redo_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnPan, pan_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnZoom, zoom_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnHome, home_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnExportImage, export_image_tool)
        self.toolbar.Bind(wx.EVT_TOOL, self.OnRectangleSelection,
                          self.rect_selection_tool)

        self.st = wx.StatusBar(self)
        self.SetStatusBar(self.st)
        self.StatusBarUpdater("")

        self.splitter = wx.SplitterWindow(
            self, -1,
            style=wx.SP_3DSASH | wx.SP_LIVE_UPDATE)  #|wx.SP_PERMIT_UNSPLIT)
        self.leftpanel = LeftPanel(self.splitter)
        self.rightpanel = RightPanel(self.splitter)

        self.splitter.SplitVertically(self.leftpanel, self.rightpanel)
        self.splitter.SetMinimumPaneSize(self.leftpanel.sb.GetSize()[0] + 15)

        self.Bind(wx.EVT_SIZE, self.OnResize)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.splitter, 1, wx.EXPAND)
        self.SetSizer(sizer)

        self.Show(True)
        #self.SetMinSize(self.GetSize())
        self.Maximize(True)
        self.Centre(wx.BOTH)
Exemple #29
0
 def test_splitterSplits(self):
     sw = wx.SplitterWindow(self.frame)
     sw.SplitHorizontally(wx.Window(sw), wx.Window(sw))
     sw.SetMinimumPaneSize(25)
     sw.SetSashPosition(150)
     sw.SetSashGravity(0.75)
Exemple #30
0
 def test_splitterCtor(self):
     sw = wx.SplitterWindow(self.frame)