Esempio n. 1
0
    def _create_popup_menu(self, widget=None):
        COPY_ID, REMOVE_ID, CUT_ID = [wx.NewId() for i in range(3)]
        menu = misc.wxGladePopupMenu(self.name)
        misc.append_menu_item(menu, REMOVE_ID, _('Remove Panel\tDel'),
                              wx.ART_DELETE)
        misc.append_menu_item(menu, COPY_ID, _('Copy\tCtrl+C'), wx.ART_COPY)
        misc.append_menu_item(menu, CUT_ID, _('Cut\tCtrl+X'), wx.ART_CUT)

        if widget is None: widget = self.widget
        wx.EVT_MENU(widget, REMOVE_ID, misc.exec_after(self.remove))
        wx.EVT_MENU(widget, COPY_ID, misc.exec_after(self.clipboard_copy))
        wx.EVT_MENU(widget, CUT_ID, misc.exec_after(self.clipboard_cut))

        PASTE_ID = wx.NewId()
        i = misc.append_menu_item(menu, PASTE_ID, _('Paste Sizer\tCtrl+V'),
                                  wx.ART_PASTE)
        wx.EVT_MENU(widget, PASTE_ID, misc.exec_after(self.clipboard_paste))
        if self.top_sizer is not None: i.Enable(False)

        PREVIEW_ID = wx.NewId()
        menu.AppendSeparator()
        misc.append_menu_item(menu, PREVIEW_ID, _('Preview'))
        wx.EVT_MENU(widget, PREVIEW_ID, misc.exec_after(self.preview_parent))

        self._rmenu = (menu, widget)  # store for destryoing and unbinding
        return menu
Esempio n. 2
0
    def _create_popup_menu(self, widget=None):
        REMOVE_ID, HIDE_ID = [wx.NewId() for i in range(2)]
        menu = misc.wxGladePopupMenu(self.name)
        misc.append_menu_item(menu, REMOVE_ID, _('Remove MenuBar\tDel'), wx.ART_DELETE)
        misc.append_menu_item(menu, HIDE_ID, _('Hide'))

        if widget is None: widget = self.widget
        wx.EVT_MENU(widget, REMOVE_ID, misc.exec_after(self.remove))
        wx.EVT_MENU(widget, HIDE_ID, misc.exec_after(self.hide_widget))
        self._rmenu = (menu, widget)
Esempio n. 3
0
    def _create_popup_menu(self):
        REMOVE_ID = wx.NewId()
        HIDE_ID = wx.NewId()
        self._rmenu = misc.wxGladePopupMenu(self.name)
        misc.append_menu_item(self._rmenu, REMOVE_ID, _('Remove ToolBar\tDel'), wx.ART_DELETE)
        misc.append_menu_item(self._rmenu, HIDE_ID, _('Hide'))

        wx.EVT_MENU(self.pwidget, REMOVE_ID, misc.exec_after(self.remove))
        wx.EVT_MENU(self.pwidget, HIDE_ID, misc.exec_after(self.hide_widget))

        self._rmenu = (menu, widget) # store for destryoing and unbinding
        return menu
Esempio n. 4
0
 def create_widget(self):
     if self.overlapped and self.parent._IS_GRIDBAG: return
     style = wx.FULL_REPAINT_ON_RESIZE
     if self.parent.CHILDREN in (-1, 1):  # e.g. Panel in a Frame
         size = self.parent.widget.GetClientSize()
     else:
         size = (20, 20)
     self.widget = wx.Window(self.parent_window.widget, -1, size=size, style=style)
     self.widget.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
     #self.widget.SetAutoLayout(True)
     self.widget.Bind(wx.EVT_PAINT, self.on_paint)
     self.widget.Bind(wx.EVT_ERASE_BACKGROUND, self.on_erase_background)
     self.widget.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
     self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_drop_widget)
     self.widget.Bind(wx.EVT_MIDDLE_DOWN, misc.exec_after(self.on_select_and_paste))
     self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
     self.widget.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave)