Esempio n. 1
0
    def OnKeyDown(self, event):
        if self.execplugin('on_first_keydown', self, event):
            return

        key = event.GetKeyCode()

        f = wx.ACCEL_NORMAL
        if event.ControlDown():
            f |= wx.ACCEL_CTRL
        if event.ShiftDown():
            f |= wx.ACCEL_SHIFT
        if event.AltDown():
            f |= wx.ACCEL_ALT
        if hasattr(event, 'CmdDown') and hasattr(wx, 'ACCEL_CMD'):
            if event.CmdDown():
                f |= wx.ACCEL_CMD

        #skip Shift+BS
        if event.ShiftDown() and key == wx.stc.STC_KEY_BACK:
            return

        if self.mainframe.editorkeycodes.has_key((f, key)):
            idname, func = self.mainframe.editorkeycodes[(f, key)]
            fu = getattr(self.mainframe, func)
            _id = Id.makeid(self.mainframe, idname)
            event.SetId(_id)
            fu(event)
            return

        if key in (ord('C'), ord('V'), ord('X')) and event.ControlDown() and not event.AltDown() and not event.ShiftDown():
            event.Skip()
            return True

        if not self.execplugin('on_key_down', self, event):
            event.Skip()
Esempio n. 2
0
def create_new(win, toolbar):
    _id = Id.makeid(win, "IDM_FILE_NEW")
    btnNew = FlatButtons.FlatBitmapMenuButton(toolbar, _id, common.getpngimage("images/new.gif"))
    btnNew.SetRightClickFunc(win.OnFileNews)
    btnNew.SetToolTip(wx.ToolTip(tr("New File")))
    wx.EVT_BUTTON(btnNew, _id, win.OnFileNew)

    return btnNew
Esempio n. 3
0
def create_next(win, toolbar):
    ID_NEXT = Id.makeid(win, 'IDM_SEARCH_NAV_NEXT')
    btnNext = FlatButtons.FlatBitmapMenuButton(toolbar, ID_NEXT, common.getpngimage('images/nav_right.gif'))
    btnNext.SetRightClickFunc(win.OnSmartNavNextFiles)
    btnNext.SetToolTip(wx.ToolTip(tr('Next File')))
    wx.EVT_BUTTON(btnNext, ID_NEXT, win.OnSmartNavNext)
    wx.EVT_UPDATE_UI(win, win.IDM_SEARCH_NAV_NEXT, win.OnUpdateUI)

    return btnNext
Esempio n. 4
0
def create_prev(win, toolbar):
    ID_PREV = Id.makeid(win, 'IDM_SEARCH_NAV_PREV')
    btnPrev = FlatButtons.FlatBitmapMenuButton(toolbar, ID_PREV, common.getpngimage('images/nav_left.gif'))
    btnPrev.SetRightClickFunc(win.OnSmartNavPrevFiles)
    btnPrev.SetToolTip(wx.ToolTip(tr('Previous File')))
    wx.EVT_BUTTON(btnPrev, ID_PREV, win.OnSmartNavPrev)
    wx.EVT_UPDATE_UI(win, win.IDM_SEARCH_NAV_PREV, win.OnUpdateUI)

    return btnPrev
Esempio n. 5
0
def create_new(win, toolbar):
    _id = Id.makeid(win, 'IDM_FILE_NEW')
    btnNew = FlatButtons.FlatBitmapMenuButton(
        toolbar, _id, common.getpngimage('images/new.gif'))
    btnNew.SetRightClickFunc(win.OnFileNews)
    btnNew.SetToolTip(wx.ToolTip(tr('New File')))
    wx.EVT_BUTTON(btnNew, _id, win.OnFileNew)

    return btnNew
Esempio n. 6
0
    def __init__(self, parent, mainframe):
        self.initmixin()
        wx.Panel.__init__(self, parent, -1)
        self.parent = parent
        self.mainframe = mainframe
        self.pref = mainframe.pref
        if not hasattr(self.pref, 'share_nodes'):
            self.pref.share_nodes = []

        self.processors = {}
#        self.callplugin('add_process_class', self, self.processors)

        self.sizer = wx.BoxSizer(wx.VERTICAL)

        self.shareimagelist = imagelist = wx.ImageList(16, 16)

        #add share image list
        self.imagefiles = {}
        self.imageids = {}
        self.callplugin('add_images', self.imagefiles)
        for name, imagefile in self.imagefiles.items():
            self.add_image(name, imagefile)

        self.tree = wx.TreeCtrl(self, -1, style = wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.TR_TWIST_BUTTONS|wx.TR_HAS_BUTTONS|wx.TR_ROW_LINES|wx.TR_HIDE_ROOT)
        self.tree.SetImageList(self.shareimagelist)

        self.sizer.Add(self.tree, 1, wx.EXPAND)
        self.root = self.tree.AddRoot('Share')

        self.nodes = {}
        self.ID = 1

        self.read()

        wx.EVT_TREE_SEL_CHANGING(self.tree, self.tree.GetId(), self.OnChanging)
        wx.EVT_TREE_SEL_CHANGED(self.tree, self.tree.GetId(), self.OnChanged)
        wx.EVT_TREE_BEGIN_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnBeginChangeLabel)
        wx.EVT_TREE_END_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnChangeLabel)
        wx.EVT_TREE_ITEM_ACTIVATED(self.tree, self.tree.GetId(), self.OnSelected)
        wx.EVT_TREE_ITEM_RIGHT_CLICK(self.tree, self.tree.GetId(), self.OnRClick)
        wx.EVT_RIGHT_UP(self.tree, self.OnRClick)
        wx.EVT_TREE_DELETE_ITEM(self.tree, self.tree.GetId(), self.OnDeleteItem)
        wx.EVT_LEFT_DCLICK(self.tree, self.OnDoubleClick)
        wx.EVT_TREE_ITEM_EXPANDING(self.tree, self.tree.GetId(), self.OnExpanding)

        from modules import Id
        wx.EVT_UPDATE_UI(self, Id.makeid(self, 'IDPM_DEL'), self.OnUpdateUI)

        #add init process
        self.callplugin('init', self)

        self.SetSizer(self.sizer)
        self.SetAutoLayout(True)

        self.popmenus = None
Esempio n. 7
0
    def OnKeyDown(self, event):
        if self.execplugin('on_first_keydown', self, event):
            return

        key = event.GetKeyCode()

        f = wx.ACCEL_NORMAL
        if event.ControlDown():
            f |= wx.ACCEL_CTRL
        if event.ShiftDown():
            f |= wx.ACCEL_SHIFT
        if event.AltDown():
            f |= wx.ACCEL_ALT
        if hasattr(event, 'CmdDown') and hasattr(wx, 'ACCEL_CMD'):
            if event.CmdDown():
                f |= wx.ACCEL_CMD

        #skip Shift+BS
        if event.ShiftDown() and key == wx.stc.STC_KEY_BACK:
            return

        if self.mainframe.editorkeycodes.has_key((f, key)):
            idname, func = self.mainframe.editorkeycodes[(f, key)]
            fu = getattr(self.mainframe, func)
            _id = Id.makeid(self.mainframe, idname)
            event.SetId(_id)
            fu(event)
            return

        if key in (ord('C'), ord('V'), ord('X')) and event.ControlDown(
        ) and not event.AltDown() and not event.ShiftDown():
            event.Skip()
            return True

        if not self.execplugin('on_key_down', self, event):
            event.Skip()
Esempio n. 8
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1, size=(0,0))

        self.parent = parent
        self.mainframe = parent

        width, height = self.GetSizeTuple()

        self.pages = []

        self.ID_TOP = Id.makeid(self, 'ID_TOP')
        self.ID_BOTTOM = Id.makeid(self, 'ID_BOTTOM')
        self.ID_LEFT = Id.makeid(self, 'ID_LEFT')
        self.ID_RIGHT = Id.makeid(self, 'ID_RIGHT')

        wx.EVT_SASH_DRAGGED(self, self.ID_TOP, self.OnSashDrag)
        wx.EVT_SASH_DRAGGED(self, self.ID_BOTTOM, self.OnSashDrag)
        wx.EVT_SASH_DRAGGED(self, self.ID_LEFT, self.OnSashDrag)
        wx.EVT_SASH_DRAGGED(self, self.ID_RIGHT, self.OnSashDrag)

        self.toptuple = (width, height)
        self.lefttuple = (0, 0)
        self.righttuple = (0, 0)
        self.bottomtuple = (0, 0)

        self.bottomsize = 20
        self.leftsize = 20
        self.rightsize = 30

        self.BottomIsVisible = False
        self.LeftIsVisible = False
        self.RightIsVisible = False

        self.top = wx.SashLayoutWindow(self, self.ID_TOP, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)

        self.top.SetDefaultSize((width, height))
        self.top.SetOrientation(wx.LAYOUT_HORIZONTAL)
        self.top.SetAlignment(wx.LAYOUT_TOP)

        self.bottom = wx.SashLayoutWindow(self, self.ID_BOTTOM, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)

        self.bottom.SetDefaultSize((width, height))
        self.bottom.SetOrientation(wx.LAYOUT_HORIZONTAL)
        self.bottom.SetAlignment(wx.LAYOUT_BOTTOM)
        self.bottom.SetSashVisible(wx.SASH_TOP, True)
#        self.bottom.SetSashBorder(wx.SASH_TOP, True)

        self.left = wx.SashLayoutWindow(self, self.ID_LEFT, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)

        self.left.SetDefaultSize((100, 1000))
        self.left.SetOrientation(wx.LAYOUT_VERTICAL)
        self.left.SetAlignment(wx.LAYOUT_LEFT)
        self.left.SetSashVisible(wx.SASH_RIGHT, True)
#        self.left.SetSashBorder(wx.SASH_RIGHT, True)

        self.right = wx.SashLayoutWindow(self, self.ID_RIGHT, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)

        self.right.SetDefaultSize((100, 1000))
        self.right.SetOrientation(wx.LAYOUT_VERTICAL)
        self.right.SetAlignment(wx.LAYOUT_RIGHT)
        self.right.SetSashVisible(wx.SASH_LEFT, True)
#        self.right.SetSashBorder(wx.SASH_LEFT, True)

        wx.EVT_SIZE(self, self.OnSize)

        self.leftbook = None
        self.rightbook = None
        self.bottombook = None
Esempio n. 9
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1, size=(0, 0))

        self.parent = parent
        self.mainframe = parent

        width, height = self.GetSizeTuple()

        self.pages = []

        self.ID_TOP = Id.makeid(self, 'ID_TOP')
        self.ID_BOTTOM = Id.makeid(self, 'ID_BOTTOM')
        self.ID_LEFT = Id.makeid(self, 'ID_LEFT')
        self.ID_RIGHT = Id.makeid(self, 'ID_RIGHT')

        wx.EVT_SASH_DRAGGED(self, self.ID_TOP, self.OnSashDrag)
        wx.EVT_SASH_DRAGGED(self, self.ID_BOTTOM, self.OnSashDrag)
        wx.EVT_SASH_DRAGGED(self, self.ID_LEFT, self.OnSashDrag)
        wx.EVT_SASH_DRAGGED(self, self.ID_RIGHT, self.OnSashDrag)

        self.toptuple = (width, height)
        self.lefttuple = (0, 0)
        self.righttuple = (0, 0)
        self.bottomtuple = (0, 0)

        self.bottomsize = 20
        self.leftsize = 20
        self.rightsize = 30

        self.BottomIsVisible = False
        self.LeftIsVisible = False
        self.RightIsVisible = False

        self.top = wx.SashLayoutWindow(self, self.ID_TOP, wx.DefaultPosition,
                                       wx.DefaultSize, wx.NO_BORDER)

        self.top.SetDefaultSize((width, height))
        self.top.SetOrientation(wx.LAYOUT_HORIZONTAL)
        self.top.SetAlignment(wx.LAYOUT_TOP)

        self.bottom = wx.SashLayoutWindow(self, self.ID_BOTTOM,
                                          wx.DefaultPosition, wx.DefaultSize,
                                          wx.NO_BORDER)

        self.bottom.SetDefaultSize((width, height))
        self.bottom.SetOrientation(wx.LAYOUT_HORIZONTAL)
        self.bottom.SetAlignment(wx.LAYOUT_BOTTOM)
        self.bottom.SetSashVisible(wx.SASH_TOP, True)
        #        self.bottom.SetSashBorder(wx.SASH_TOP, True)

        self.left = wx.SashLayoutWindow(self, self.ID_LEFT, wx.DefaultPosition,
                                        wx.DefaultSize, wx.NO_BORDER)

        self.left.SetDefaultSize((100, 1000))
        self.left.SetOrientation(wx.LAYOUT_VERTICAL)
        self.left.SetAlignment(wx.LAYOUT_LEFT)
        self.left.SetSashVisible(wx.SASH_RIGHT, True)
        #        self.left.SetSashBorder(wx.SASH_RIGHT, True)

        self.right = wx.SashLayoutWindow(self, self.ID_RIGHT,
                                         wx.DefaultPosition, wx.DefaultSize,
                                         wx.NO_BORDER)

        self.right.SetDefaultSize((100, 1000))
        self.right.SetOrientation(wx.LAYOUT_VERTICAL)
        self.right.SetAlignment(wx.LAYOUT_RIGHT)
        self.right.SetSashVisible(wx.SASH_LEFT, True)
        #        self.right.SetSashBorder(wx.SASH_LEFT, True)

        wx.EVT_SIZE(self, self.OnSize)

        self.leftbook = None
        self.rightbook = None
        self.bottombook = None