Beispiel #1
0
    def __init__(self, parent, title):
        wx.MDIChildFrame.__init__(self, parent,
                                  title=title)  #, style=wx.MAXIMIZE)

        self.mainPanel = wx.Panel(parent=self,
                                  name='panel1',
                                  style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN
                                  | wx.FULL_REPAINT_ON_RESIZE,
                                  pos=(0, 0),
                                  size=self.Size)
        #self.mainPanel = self
        self.mainPanel.SetAutoLayout(True)

        self.grid = SimpleGrid(
            self.mainPanel, (self.Size.x, self.Size.y - 24),
            column_names=["Process name", "Path", "Argumens"],
            default_rowcount=0)
        self.grid.SetConstraints(
            anchors.LayoutAnchors(self.grid, True, True, True, True))
        # Кнопка
        self.rebindButton = wx.Button(label='Refresh',
                                      id=ID_REBINDBUTTON,
                                      parent=self.mainPanel,
                                      name='rebindButton',
                                      size=(72, 24),
                                      style=0,
                                      pos=(0, self.Size.y - 24))
        self.rebindButton.SetConstraints(
            anchors.LayoutAnchors(self.rebindButton, True, False, False, True))
        self.Bind(wx.EVT_BUTTON, self.OnRebindButtonClick, id=ID_REBINDBUTTON)
        # Кнопка
        self.savedbButton = wx.Button(label='Save to DB',
                                      id=ID_SAVEDBBUTTON,
                                      parent=self.mainPanel,
                                      name='savedbButton',
                                      size=(72, 24),
                                      style=0,
                                      pos=(72, self.Size.y - 24))
        self.savedbButton.SetConstraints(
            anchors.LayoutAnchors(self.savedbButton, True, False, False, True))
        self.Bind(wx.EVT_BUTTON, self.OnSavedbButtonClick, id=ID_SAVEDBBUTTON)
        #Кнопка
        self.okButton = wx.Button(label='OK',
                                  id=ID_OKBUTTON,
                                  parent=self.mainPanel,
                                  name='okButton',
                                  size=(72, 24),
                                  style=0,
                                  pos=(self.Size.x - 72, self.Size.y - 24))
        self.okButton.SetConstraints(
            anchors.LayoutAnchors(self.okButton, False, False, True, True))
        self.Bind(wx.EVT_BUTTON, self.OnOkButtonClick, id=ID_OKBUTTON)
    def __init__(self, parent, id, title, pos, size=(800, 600)):
        wx.Frame.__init__(self, parent, id, title, pos, size)

        self.mainpanel = wx.Panel(self, -1, size=(800, 600))
        self.mainpanel.SetAutoLayout(True)

        self.leftwindow = wx.Panel(self.mainpanel, -1, (10, 10), (380, 450))
        self.leftwindow.SetBackgroundColour(wx.WHITE)
        self.leftwindow.SetConstraints(
            anchors.LayoutAnchors(self.leftwindow, True, True, True, True))

        self.rightwindow = wx.Panel(self.mainpanel, -1, (400, 10), (380, 450))
        self.rightwindow.SetBackgroundColour(wx.WHITE)
        self.rightwindow.SetConstraints(
            anchors.LayoutAnchors(self.rightwindow, False, True, True, True))

        playvideo = wx.Button(self.mainpanel, -1,
                              "Play media on this window...", (500, 500))
        playvideo.SetConstraints(
            anchors.LayoutAnchors(playvideo, False, False, True, True))
        self.Bind(wx.EVT_BUTTON, self.playVideo, playvideo)

        #Create a DirectPython window from an existing wxPython window.
        tempWindow = d3d11.Window(handle=self.leftwindow.GetHandle())

        #Create our resources. Note that if the size of the window
        #changes, you should call self.device.reset().
        self.device = d3d11.Device(tempWindow, DRIVER_TYPE_WARP)
        self.effect = d3d11.Effect(
            d3d11x.getResourceDir("Effects", "Tutorial2.fx"))
        self.inputLayout = d3d11.InputLayout(vertexDesc, self.effect, 0, 0)
        self.vertexBuffer = d3d11.Buffer(vertexDesc, triangle,
                                         BIND_VERTEX_BUFFER)

        #We need to detach() the window. This means that it is up to
        #us (or wxPython) to mange the window from now on.
        tempWindow.detach()

        self.media = None

        self.Bind(wx.EVT_PAINT, self.onPaint)
        self.Bind(wx.EVT_TIMER, self.onTimer)
        self.Bind(wx.EVT_IDLE, self.onIdle)
        self.leftwindow.Bind(wx.EVT_SIZE, self.onSize)

        #Use a timer for rendering. It is not a very smooth
        #solution, you might want to tweak the time interval
        #or do something else, now it is jerky.
        self.timer = wx.Timer(self)
        self.timer.Start(10)
Beispiel #3
0
 def OnCheckboxCheckbox(self, event):
     self.anchoredPanel.SetConstraints(
         anchors.LayoutAnchors(self.anchoredPanel,
                               self.leftCheckBox.GetValue(),
                               self.topCheckBox.GetValue(),
                               self.rightCheckBox.GetValue(),
                               self.bottomCheckBox.GetValue()))
Beispiel #4
0
    def SetPanel2(self, obj):
        """
        Вставляет оконный объект на клиентскую панель.
        """
        # Получаем указатель на сайзер (GridBagSizer)
        pnl = self.getRegObj('clientRgPanel')
        #bszr = self.getRegObj('clientRgSizer')
        pnl.SetAutoLayout(True)
        clientPos = (1,1)
        clientSpan = (1,1)

        if self.last:
            # Сохраняем изменения
            
            # Удаляем старую форму
            self.last.Show(False)
            #bszr.Remove(self.last)
            self.last = None
            
        obj.Reparent(pnl)
        #bszr.Add(obj, clientPos, clientSpan, wx.EXPAND, 1)
        obj.SetPosition((5,5))
        obj.SetConstraints(anchors.LayoutAnchors(obj, True, True, True, True))
        obj.Show()
        self.last = obj
Beispiel #5
0
    def _init_ctrls(self, prnt):
        wx.Frame.__init__(self,
                          size=(328, 187),
                          id=ID_ANCHORSDEMOFRAME,
                          title='LayoutAnchors Demonstration',
                          parent=prnt,
                          name='AnchorsDemoFrame',
                          style=wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN,
                          pos=(261, 123))

        self._init_utils()

        self.mainPanel = wx.Panel(size=(320, 160),
                                  parent=self,
                                  id=ID_ANCHORSDEMOFRAMEMAINPANEL,
                                  name='panel1',
                                  style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN
                                  | wx.FULL_REPAINT_ON_RESIZE,
                                  pos=(0, 0))

        self.mainPanel.SetAutoLayout(True)

        self.okButton = wx.Button(label='OK',
                                  id=ID_ANCHORSDEMOFRAMEOKBUTTON,
                                  parent=self.mainPanel,
                                  name='okButton',
                                  size=(72, 24),
                                  style=0,
                                  pos=(240, 128))

        self.okButton.SetConstraints(
            anchors.LayoutAnchors(self.okButton, False, False, True, True))

        self.Bind(wx.EVT_BUTTON,
                  self.OnOkButtonButton,
                  id=ID_ANCHORSDEMOFRAMEOKBUTTON)

        self.backgroundPanel = wx.Panel(size=(304, 80),
                                        parent=self.mainPanel,
                                        id=ID_ANCHORSDEMOFRAMEBACKGROUNDPANEL,
                                        name='backgroundPanel',
                                        style=wx.SIMPLE_BORDER
                                        | wx.CLIP_CHILDREN,
                                        pos=(8, 40))

        self.backgroundPanel.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.backgroundPanel.SetConstraints(
            anchors.LayoutAnchors(self.backgroundPanel, True, True, True,
                                  True))

        self.anchoredPanel = wx.Panel(size=(88, 48),
                                      id=ID_ANCHORSDEMOFRAMEANCHOREDPANEL,
                                      parent=self.backgroundPanel,
                                      name='anchoredPanel',
                                      style=wx.SIMPLE_BORDER,
                                      pos=(104, 16))

        self.anchoredPanel.SetBackgroundColour(wx.Colour(0, 0, 222))
        self.anchoredPanel.SetConstraints(
            anchors.LayoutAnchors(self.anchoredPanel, False, False, False,
                                  False))

        self.leftCheckBox = wx.CheckBox(label='Left',
                                        id=ID_ANCHORSDEMOFRAMELEFTCHECKBOX,
                                        parent=self.mainPanel,
                                        name='leftCheckBox',
                                        style=0,
                                        pos=(8, 8))

        self.leftCheckBox.SetConstraints(
            anchors.LayoutAnchors(self.leftCheckBox, False, True, False,
                                  False))

        self.Bind(wx.EVT_CHECKBOX,
                  self.OnCheckboxCheckbox,
                  source=self.leftCheckBox,
                  id=ID_ANCHORSDEMOFRAMELEFTCHECKBOX)

        self.topCheckBox = wx.CheckBox(label='Top',
                                       id=ID_ANCHORSDEMOFRAMETOPCHECKBOX,
                                       parent=self.mainPanel,
                                       name='topCheckBox',
                                       style=0,
                                       pos=(88, 8))

        self.topCheckBox.SetConstraints(
            anchors.LayoutAnchors(self.topCheckBox, False, True, False, False))

        self.Bind(wx.EVT_CHECKBOX,
                  self.OnCheckboxCheckbox,
                  source=self.topCheckBox,
                  id=ID_ANCHORSDEMOFRAMETOPCHECKBOX)

        self.rightCheckBox = wx.CheckBox(label='Right',
                                         id=ID_ANCHORSDEMOFRAMERIGHTCHECKBOX,
                                         parent=self.mainPanel,
                                         name='rightCheckBox',
                                         style=0,
                                         pos=(168, 8))

        self.rightCheckBox.SetConstraints(
            anchors.LayoutAnchors(self.rightCheckBox, False, True, False,
                                  False))

        self.Bind(wx.EVT_CHECKBOX,
                  self.OnCheckboxCheckbox,
                  source=self.rightCheckBox,
                  id=ID_ANCHORSDEMOFRAMERIGHTCHECKBOX)

        self.bottomCheckBox = wx.CheckBox(label='Bottom',
                                          id=ID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX,
                                          parent=self.mainPanel,
                                          name='bottomCheckBox',
                                          style=0,
                                          pos=(248, 8))

        self.bottomCheckBox.SetConstraints(
            anchors.LayoutAnchors(self.bottomCheckBox, False, True, False,
                                  False))

        self.Bind(wx.EVT_CHECKBOX,
                  self.OnCheckboxCheckbox,
                  source=self.bottomCheckBox,
                  id=ID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX)

        self.helpStaticText = wx.StaticText(
            label=
            'Select anchor options above, then resize window to see the effect',
            id=ID_ANCHORSDEMOFRAMEHELPSTATICTEXT,
            parent=self.mainPanel,
            name='helpStaticText',
            size=(224, 24),
            style=wx.ST_NO_AUTORESIZE,
            pos=(8, 128))

        self.helpStaticText.SetConstraints(
            anchors.LayoutAnchors(self.helpStaticText, True, False, True,
                                  True))
Beispiel #6
0
    def __init__(self):
        wx.Frame.__init__(
            self, None, size=(900, 640), id=ID_ANCHORSDEMOFRAME, 
            title='DM Cluster', 
            name='AnchorsDemoFrame', 
            style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | \
            wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN, pos=(200, 60)
            )
        self.mainPanel = wx.Panel(
                            size=(900, 640), parent=self, 
                            id=ID_ANCHORSDEMOFRAMEMAINPANEL, name='panel1', 
                            style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN
                            | wx.FULL_REPAINT_ON_RESIZE, 
                            pos=(0, 0)
                            )
        self.mainPanel.SetAutoLayout(True)        
        
        self.fbbh = filebrowse.FileBrowseButton(
            self.mainPanel, -1, size=(300, 30), changeCallback = self.fbbhCallback, pos=(10,5)
            )
        
        clusterList = ['kmeans', 'dbscan']
        ch = wx.Choice(self.mainPanel, -1, (320, 7), choices = clusterList)
        ch.SetSelection(0)
        self.Bind(wx.EVT_CHOICE, self.EvtChoice, ch)

        global backgroundHeight
        self.backgroundPanel = wx.Panel(
                                size=(884, 500), parent=self.mainPanel, 
                                id=ID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, 
                                name='backgroundPanel', 
                                style=wx.SIMPLE_BORDER | wx.CLIP_CHILDREN, 
                                pos = (8, 40)
                                )
        
        self.backgroundPanel.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.backgroundPanel.SetConstraints(
            anchors.LayoutAnchors(self.backgroundPanel, True, True, True, True)
            )

        drawbutton = wx.Button(parent=self.mainPanel, size=(80, 22), label="Cluster", id=ID_ANCHORSDEMOFRAMEDRAWBUTTON)
        drawbutton.SetPosition((430, 8))
        self.Bind(
            wx.EVT_BUTTON, self.OnDrawButton, id=ID_ANCHORSDEMOFRAMEDRAWBUTTON
            )        
        
        lastbutton = wx.Button(parent=self.mainPanel, size=(90, 22), label="Last Result", id=ID_ANCHORSDEMOFRAMELASTBUTTON)
        lastbutton.SetPosition((520, 8))
        self.Bind(
            wx.EVT_BUTTON, self.OnLastButton, id=ID_ANCHORSDEMOFRAMELASTBUTTON
            )
        
        drawbutton2 = wx.Button(parent=self.mainPanel, size=(110, 22), label="Show Iteration", id=ID_ANCHORSDEMOFRAMEDRAWBUTTON2)
        drawbutton2.SetPosition((620, 8))
        self.Bind(
            wx.EVT_BUTTON, self.OnShowButton, id=ID_ANCHORSDEMOFRAMEDRAWBUTTON2
            )
        
        backButton = wx.Button(parent=self.mainPanel, size=(80, 22), label="Back Step", id=ID_ANCHORSDEMOFRAMEBACKBUTTON)
        backButton.SetPosition((740, 8))

        self.Bind(
            wx.EVT_BUTTON, self.OnBackButton, id=ID_ANCHORSDEMOFRAMEBACKBUTTON
            )
        
        clearButton = wx.Button(parent=self.mainPanel, size=(50, 22), label="Clear", id=ID_ANCHORSDEMOFRAMECLEARBUTTON)
        clearButton.SetPosition((835, 8))

        self.Bind(
            wx.EVT_BUTTON, self.OnclearButton, id=ID_ANCHORSDEMOFRAMECLEARBUTTON
            )

        self.helpStaticText = wx.StaticText(
                                label='Since DBSCAN-ALGORITHM doesn\'t have an iteration '+ 
                                'progress, only KMEANS is supported with iteration demonstrating. '
                                'Press button \"Show Iteration\" or \"back step\" and have a try. Enjoy it!', 
                                id=ID_ANCHORSDEMOFRAMEHELPSTATICTEXT, 
                                parent=self.mainPanel, name='helpStaticText', 
                                size=(600, 60), style=wx.ST_NO_AUTORESIZE, 
                                pos=(18, 534)
                                )
        self.helpStaticText.SetFont(wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Courier New'))

        self.helpStaticText2 = wx.StaticText(
                                        label='Iteration times : not defined\nNow: havn\'t started', 
                                        id=ID_ANCHORSDEMOFRAMEHELPSTATICTEXT2, 
                                        parent=self.mainPanel, name='helpStaticText2', 
                                        size=(285, 60), style=wx.ST_NO_AUTORESIZE, 
                                        pos=(640, 534)
                                        )
        self.helpStaticText2.SetFont(wx.Font(14, wx.DECORATIVE, wx.ITALIC, wx.BOLD, False))
        self.helpStaticText2.SetForegroundColour('RED')