Пример #1
0
    def test_propgrideditors01(self):
        wl = pg.PGWindowList()
        assert wl.m_primary is None
        assert wl.m_secondary is None

        wl = pg.PGWindowList(self.frame)
        assert wl.m_primary is self.frame
Пример #2
0
    def test_propgrideditors01(self):
        wl = pg.PGWindowList(self.frame)
        assert wl.GetPrimary() is self.frame
        assert wl.GetSecondary() is None

        wl = pg.PGWindowList(self.frame, None)
        assert wl.GetPrimary() is self.frame
        assert wl.GetSecondary() is None
Пример #3
0
    def CreateControls(self, propgrid, property, pos, sz):
        """ Create the actual wxPython controls here for editing the
            property value.

            You must use propgrid.GetPanel() as parent for created controls.

            Return value is either single editor control or tuple of two
            editor controls, of which first is the primary one and second
            is usually a button.
        """
        try:
            x, y = pos
            w, h = sz
            h = 64 + 6

            # Make room for button
            bw = propgrid.GetRowHeight()
            w -= bw

            s = property.GetDisplayedString()

            tc = wx.TextCtrl(propgrid.GetPanel(), wxpg.PG_SUBID1, s, (x, y),
                             (w, h), wx.TE_PROCESS_ENTER)
            btn = wx.Button(propgrid.GetPanel(), wxpg.PG_SUBID2, '...',
                            (x + w, y), (bw, h), wx.WANTS_CHARS)
            return wxpg.PGWindowList(tc, btn)
        except:
            import traceback
            print(traceback.print_exc())
Пример #4
0
    def CreateControls(self, propGrid, property, pos, sz):
        # Create and populate buttons-subwindow
        buttons = wxpg.PGMultiButton(propGrid, sz)

        # Add two regular buttons
        buttons.AddButton("...")
        buttons.AddButton("A")
        # Add a bitmap button
        buttons.AddBitmapButton(wx.ArtProvider.GetBitmap(wx.ART_FOLDER))

        # Create the 'primary' editor control (textctrl in this case)
        wnd = super(SampleMultiButtonEditor,
                    self).CreateControls(propGrid, property, pos,
                                         buttons.GetPrimarySize())
        wnd = wnd.m_primary

        # Finally, move buttons-subwindow to correct position and make sure
        # returned wxPGWindowList contains our custom button list.
        buttons.Finalize(propGrid, pos)

        # We must maintain a reference to any editor objects we created
        # ourselves. Otherwise they might be freed prematurely. Also,
        # we need it in OnEvent() below, because in Python we cannot "cast"
        # result of wxPropertyGrid.GetEditorControlSecondary() into
        # PGMultiButton instance.
        self.buttons = buttons

        return wxpg.PGWindowList(wnd, buttons)
Пример #5
0
    def CreateControls(self, propgrid, property, pos, sz):
        try:
            x, y = pos
            w, h = sz
            h = 64 + 6

            # Make room for button
            bw = propgrid.GetRowHeight()
            w -= bw

            self.property = property

            self.RefreshThumbnail()
            self.statbmp = wx.StaticBitmap(propgrid.GetPanel(), -1, self.bmp,
                                           (x, y))
            self.tc = wx.TextCtrl(propgrid.GetPanel(), -1, "", (x + h, y),
                                  (2048, h), wx.BORDER_NONE)

            btn = wx.Button(propgrid.GetPanel(), wxpg.PG_SUBID2, '...',
                            (x + w, y), (bw, h), wx.WANTS_CHARS)

            # When the textctrl is destroyed, destroy the statbmp too
            def _cleanupStatBmp(evt):
                if self.statbmp:
                    self.statbmp.Destroy()

            self.tc.Bind(wx.EVT_WINDOW_DESTROY, _cleanupStatBmp)

            return wxpg.PGWindowList(self.tc, btn)
        except:
            import traceback
            print(traceback.print_exc())
Пример #6
0
    def CreateControls(self, propGrid, property, pos, sz):
        # Create and populate buttons-subwindow
        buttons = wxpg.PGMultiButton(propGrid, sz)

        # Add two regular buttons
        buttons.AddBitmapButton(
            wx.Bitmap(Chemins.GetStaticPath("Images/16x16/Mecanisme.png"),
                      wx.BITMAP_TYPE_PNG))
        buttons.GetButton(0).SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour accéder à la gestion des paramètres")))

        # Create the 'primary' editor control (textctrl in this case)
        if 'phoenix' in wx.PlatformInfo:
            wnd = super(EditeurComboBoxAvecBoutons,
                        self).CreateControls(propGrid, property, pos,
                                             buttons.GetPrimarySize())
            wnd = wnd.m_primary
            buttons.Finalize(propGrid, pos)
            self.buttons = buttons
            return wxpg.PGWindowList(wnd, buttons)
        else:
            wnd = self.CallSuperMethod("CreateControls", propGrid, property,
                                       pos, buttons.GetPrimarySize())
            buttons.Finalize(propGrid, pos)
            self.buttons = buttons
            return (wnd, buttons)
Пример #7
0
 def CreateControls(self, propGrid, property, pos, size):
     if 'phoenix' in wx.PlatformInfo:
         ctrl = super(EditeurChoix, self).CreateControls(propGrid, property, pos, size)
         ctrl = ctrl.m_primary
         self.SetControlIntValue(property, ctrl, 0)
         return wxpg.PGWindowList(ctrl)
     else :
         ctrl = self.CallSuperMethod("CreateControls", propGrid, property, pos, size)
         self.SetControlIntValue(property, ctrl, 0)
         return ctrl
Пример #8
0
 def CreateControls(self, propgrid, property, pos, size):
     try:
         ctrl = ctrl = CTRL_Saisie_date.Date2(propgrid.GetPanel(), pos=pos, size=(-1, 25))
         ctrl.SetDate(property.GetDisplayedString())
         if 'phoenix' in wx.PlatformInfo:
             return wxpg.PGWindowList(ctrl)
         else :
             return ctrl
     except:
         import traceback
         print((traceback.print_exc()))
Пример #9
0
 def CreateControls(self, propgrid, property, pos, size):
     try:
         ctrl = CTRL_Saisie_heure.Heure(propgrid.GetPanel(), id=wxpg.PG_SUBID1, pos=pos, size=size, style=wx.TE_PROCESS_ENTER)
         ctrl.SetHeure(property.GetDisplayedString())
         if 'phoenix' in wx.PlatformInfo:
             return wxpg.PGWindowList(ctrl)
         else :
             return ctrl
     except:
         import traceback
         print((traceback.print_exc()))
Пример #10
0
    def CreateControls(self, propgrid, property, pos, sz):
        try:
            x, y = pos
            w, h = sz
            h = 64 + 6

            # Make room for button
            bw = propgrid.GetRowHeight()
            w -= bw

            lipc = LargeImagePickerCtrl()
            if sys.platform.startswith('win'):
                lipc.Hide()
            lipc.Create(propgrid.GetPanel(), wxpg.PG_SUBID1, (x, y), (w, h))
            lipc.SetProperty(property)
            btn = wx.Button(propgrid.GetPanel(), wxpg.PG_SUBID2, '...',
                            (x + w, y), (bw, h), wx.WANTS_CHARS)
            return wxpg.PGWindowList(lipc, btn)
        except:
            import traceback
            print(traceback.print_exc())
Пример #11
0
    def CreateControls(self, propgrid, property, pos, sz):
        """ Create the actual wxPython controls here for editing the
            property value.
            You must use propgrid.GetPanel() as parent for created controls.
            Return value is either single editor control or tuple of two
            editor controls, of which first is the primary one and second
            is usually a button.
        """
        try:
            x, y = pos
            w, h = sz
            h = 100

            s = property.GetDisplayedString()

            self.tc = CustomTextCtrl(propgrid.GetPanel(), wxpg.PG_SUBID1, s,
                                     (x, y), (w, h),
                                     wx.TE_MULTILINE | wx.TE_PROCESS_ENTER)

            return wxpg.PGWindowList(self.tc)  #, btn)
        except:
            import traceback
            print(traceback.print_exc())
Пример #12
0
 def CreateControls(self, propgrid, prop, pos, size):
     return pg.PGWindowList()