Ejemplo n.º 1
0
    def __init__(self, name, klass, parent, id):
        EditBase.__init__(self, name, klass, parent, id)

        self.window_id = np.TextPropertyD("wxID_ANY",
                                          name="id",
                                          default_value=None)
        self.size = np.SizePropertyD("-1, -1", default_value="-1, -1")

        self.sel_marker = None  # selection markers (a SelectionMarker instance)

        # background, foreground, font properties
        # their actual values will be stored/modified after widget creation in 'finish_widget_creation'
        # before that, the actual values will be stored in this dict from the actual values of the widget:
        self._original = {'font': None}
        # colors
        self.background = np.ColorPropertyD(None)
        self.foreground = np.ColorPropertyD(None)
        # font
        if "font" in self.PROPERTIES:
            self._font_changed = False  # this is True if the user has selected a custom font
            if config.use_gui:
                font = self._build_from_font(
                    compat.wx_SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
                font[1] = 'default'
            else:
                font = (9, 'default', 'normal', 'normal', 0, 'Segoe UI')
            self.font = np.FontPropertyD(tuple(font))

        # tooltip, focused, hiden
        self.tooltip = np.TextPropertyD(multiline="grow")
        self.disabled = np.CheckBoxProperty(False, default_value=False)
        self.focused = np.CheckBoxProperty(False, default_value=False)
        self.hidden = np.CheckBoxProperty(False, default_value=False)
Ejemplo n.º 2
0
 def GetBestSize(self):
     if not self.__radio_size:
         dc = wx.ScreenDC()
         dc.SetFont(compat.wx_SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT))
         self.__radio_size = (3*dc.GetCharHeight())//2
     label = self.GetLabel()
     if label:
         w, h = self.GetTextExtent(label)
         w += self.__radio_size + self.GetCharWidth()
         if h < self.__radio_size:
             h = self.__radio_size
     else:
         w = h = self.__radio_size
     return w, h