Exemplo n.º 1
0
    def __init__(self, parent, tabName):
        self.tabName = tabName
        self.first = False
        self.active = False
        self.hovering = False  # is the user hovering the mouse over the control
        self.clicking = False  # is the user clicking the control
        self.font = getDefaultFont()
        # FIXME (EPW) make these colors settable
        self.borderColor = getDefaultControlBorderColor()
        self.tabColor = getDefaultDialogBackgroundColor()
        self.activeColor = getDefaultControlBackgroundColor()
        self.hoverColor = wx.Color(min(self.tabColor.Red() + 20, 255),
                                   min(self.tabColor.Green() + 20, 255),
                                   min(self.tabColor.Blue(), 255))

        wx.Control.__init__(self, parent, wx.ID_ANY, style=wx.NO_BORDER)

        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
        self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)

        # FIXME allow the font to be changed - when that is done, size hints must be recalc'd
        winDC = wx.WindowDC(parent)
        winDC.SetFont(self.font)
        (w, h) = winDC.GetTextExtent(tabName)
        self.SetSizeHints(w + 10, h + 10)
        del winDC
Exemplo n.º 2
0
    def __init__(self, parent, alignment = wx.ALIGN_LEFT, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.DefaultSize, style = 0, name = u"ZPropertyBook"): #$NON-NLS-1$
        self.tabs = {}
        self.tabAreaBGColor = getDefaultDialogBackgroundColor()
        self.bgColor = getDefaultControlBackgroundColor()
        self.borderColor = getDefaultControlBorderColor()

        wx.Panel.__init__(self, parent, wx.ID_ANY, pos, size, style, name)
        
        self.SetBackgroundColour(self.bgColor)
        
        # Create a tab container, sizer to store the panels, and the overall property book sizer
        self.tabContainer = ZPropertyBookTabContainer(self, alignment, self.tabAreaBGColor, self.borderColor)
        self.tabPanelSizer = wx.BoxSizer(wx.VERTICAL)
        self.bookSizer = wx.BoxSizer(wx.HORIZONTAL)
        
        self.bookSizer.Add(self.tabContainer, 0, wx.EXPAND)
        self.bookSizer.AddSizer(self.tabPanelSizer, 1, wx.EXPAND | wx.ALL, 3)
        
        self.Bind(ZEVT_PB_TAB_SELECTION, self.onTabSelection, self.tabContainer)
        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
        self.Bind(wx.EVT_SIZE, self.onResize, self)
        
        self.SetAutoLayout(True)
        self.SetSizer(self.bookSizer)
        self.Layout()
Exemplo n.º 3
0
 def __init__(self, parent, tabName):
     self.tabName = tabName
     self.first = False
     self.active = False
     self.hovering = False # is the user hovering the mouse over the control
     self.clicking = False # is the user clicking the control
     self.font = getDefaultFont()
     # FIXME (EPW) make these colors settable
     self.borderColor = getDefaultControlBorderColor()
     self.tabColor = getDefaultDialogBackgroundColor()
     self.activeColor = getDefaultControlBackgroundColor()
     self.hoverColor = wx.Color(min(self.tabColor.Red() + 20, 255), min(self.tabColor.Green() + 20, 255), min(self.tabColor.Blue(), 255))
     
     wx.Control.__init__(self, parent, wx.ID_ANY, style = wx.NO_BORDER)
     
     self.Bind(wx.EVT_PAINT, self.onPaint, self)
     self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
     self.Bind(wx.EVT_ENTER_WINDOW, self.onEnter, self)
     self.Bind(wx.EVT_LEAVE_WINDOW, self.onLeave, self)
     self.Bind(wx.EVT_LEFT_DOWN, self.onLeftClickDown, self)
     self.Bind(wx.EVT_LEFT_UP, self.onLeftClickUp, self)
     
     # FIXME allow the font to be changed - when that is done, size hints must be recalc'd
     winDC = wx.WindowDC(parent)
     winDC.SetFont(self.font)
     (w, h) = winDC.GetTextExtent(tabName)
     self.SetSizeHints(w + 10, h + 10)
     del winDC
Exemplo n.º 4
0
    def _createWidgets(self):
        self.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.metaDataWidget = ZBlogPostMetaDataWidget(self, self._getModel().getMetaDataModel() )
        self.metaDataWidget.SetBackgroundColour(getDefaultDialogBackgroundColor())
        self.contentEditCtrl = self._createContentEditCtrl(self)
        # Note: toolbar must be created only after the contentEditCtrl has been created (so that edit control capabilities can be determined)
        self.toolBar = self._createToolBar()
        self.tbStaticLine = wx.StaticLine(self, wx.ID_ANY)

        self.acceleratorTable = ZBlogPostContentEditorAcceleratorTable(ZBlogPostEditorToolBarActionContext(self))
        self.contentEditCtrl.SetAcceleratorTable(self.acceleratorTable)
Exemplo n.º 5
0
    def _createWidgets(self):
        self.SetBackgroundColour(wx.Colour(255, 255, 255))
        self.metaDataWidget = ZBlogPostMetaDataWidget(
            self,
            self._getModel().getMetaDataModel())
        self.metaDataWidget.SetBackgroundColour(
            getDefaultDialogBackgroundColor())
        self.contentEditCtrl = self._createContentEditCtrl(self)
        # Note: toolbar must be created only after the contentEditCtrl has been created (so that edit control capabilities can be determined)
        self.toolBar = self._createToolBar()
        self.tbStaticLine = wx.StaticLine(self, wx.ID_ANY)

        self.acceleratorTable = ZBlogPostContentEditorAcceleratorTable(
            ZBlogPostEditorToolBarActionContext(self))
        self.contentEditCtrl.SetAcceleratorTable(self.acceleratorTable)
Exemplo n.º 6
0
    def __init__(self, contentProvider, eventHandler, parent, style=0):
        self.style = style
        self.tools = []
        self.contentProvider = contentProvider
        if self.contentProvider is None:
            self.contentProvider = ZEmptyToolBarProvider()
        self.eventHandler = eventHandler
        self.showTextFlag = False
        self.toolSize = self.contentProvider.getToolBitmapSize()

        wx.Panel.__init__(self, parent, wx.ID_ANY)
        self.SetBackgroundColour(getDefaultDialogBackgroundColor())

        self._createWidgets()
        self._layoutWidgets()
        self._bindWidgetEvents()

        if style & ZToolBar.STYLE_SHOW_TEXT:
            self.showText(True)
        else:
            self.showText(False)

        self.refresh()
Exemplo n.º 7
0
    def __init__(self,
                 parent,
                 alignment=wx.ALIGN_LEFT,
                 id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=0,
                 name=u"ZPropertyBook"):  #$NON-NLS-1$
        self.tabs = {}
        self.tabAreaBGColor = getDefaultDialogBackgroundColor()
        self.bgColor = getDefaultControlBackgroundColor()
        self.borderColor = getDefaultControlBorderColor()

        wx.Panel.__init__(self, parent, wx.ID_ANY, pos, size, style, name)

        self.SetBackgroundColour(self.bgColor)

        # Create a tab container, sizer to store the panels, and the overall property book sizer
        self.tabContainer = ZPropertyBookTabContainer(self, alignment,
                                                      self.tabAreaBGColor,
                                                      self.borderColor)
        self.tabPanelSizer = wx.BoxSizer(wx.VERTICAL)
        self.bookSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.bookSizer.Add(self.tabContainer, 0, wx.EXPAND)
        self.bookSizer.AddSizer(self.tabPanelSizer, 1, wx.EXPAND | wx.ALL, 3)

        self.Bind(ZEVT_PB_TAB_SELECTION, self.onTabSelection,
                  self.tabContainer)
        self.Bind(wx.EVT_PAINT, self.onPaint, self)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.onEraseBackground, self)
        self.Bind(wx.EVT_SIZE, self.onResize, self)

        self.SetAutoLayout(True)
        self.SetSizer(self.bookSizer)
        self.Layout()