コード例 #1
0
    def createDocument(self):
        from mixins.Editor import TextEditor

        panel = wx.Panel(self.top, -1)
        document = TextEditor(panel, self.parent, self.filename, self.documenttype)
        box = wx.BoxSizer(wx.VERTICAL)

        self.callplugin('new_control', document, panel, box)
        box.Add(document, 1, wx.EXPAND)

        panel.SetSizer(box)
        panel.SetAutoLayout(True)

        return document
コード例 #2
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        self.sizer = sizer = ui.VBox(
            padding=0, namebinding='widget').create(self).auto_layout()
        box = sizer.add(ui.HBox(padding=2))
        self.btnRefresh = FlatButtons.FlatBitmapButton(
            self, -1, common.getpngimage('images/classbrowserrefresh.gif'))
        box.add(self.btnRefresh)
        self.code = TextEditor(self, None, 'canvas test', 'texteditor', True)
        self.code.cansavefileflag = False
        self.code.needcheckfile = False
        self.code.savesession = False
        sizer.add(self.code, proportion=1, flag=wx.EXPAND | wx.ALL, border=3)
        sizer.auto_fit(0)
コード例 #3
0
ファイル: mCodeSnippet.py プロジェクト: zztalker/ulipad
def createCodeSnippetEditWindow(win):
    snippet = None
    for pagename, panelname, notebook, page in win.panel.getPages():
        if hasattr(page, 'code_snippet') and page.code_snippet:
            snippet = page
            break
    if not snippet:
        from mixins.Editor import TextEditor
        snippet = TextEditor(win.panel.createNotebook('bottom'), None, 'Snippet', 'texteditor', True)
        #.document is important
        snippet.document = snippet
        snippet.cansavefileflag = False
        snippet.needcheckfile = False
        snippet.savesession = False
        snippet.code_snippet = True
        win.panel.addPage('bottom', snippet, tr('Snippet'))
    if snippet:
        win.panel.showPage(snippet)
        return snippet
コード例 #4
0
    def __init__(self, parent, mainframe, filename, documenttype, **kwargs):
        self.initmixin()

        wx.Panel.__init__(self, parent, -1)
        DocumentBase.DocumentBase.__init__(self, parent, filename,
                                           documenttype, **kwargs)
        self.mainframe = mainframe
        self.pref = mainframe.pref

        self.siteindex = self.pref.last_blog_site
        if len(self.pref.blog_sites) > 0:
            site = self.pref.blog_sites_info[self.pref.blog_sites[
                self.siteindex]]
        else:
            site = {}
        self.categoryindex = site.get('last_category', 0)
        self.dateCreated = ''
        self.postid = ''

        box = wx.BoxSizer(wx.VERTICAL)

        box1 = wx.BoxSizer(wx.HORIZONTAL)

        #title
        obj = wx.StaticText(self, -1, tr('Title:'))
        box1.Add(obj, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)
        self.txtTitle = wx.TextCtrl(self, -1, "", size=(-1, 20))
        box1.Add(self.txtTitle, 1, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        #categories
        obj = wx.StaticText(self, -1, tr('Category:'))
        box1.Add(obj, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)
        self.ID_CATELIST = wx.NewId()
        self.cmbCategory = wx.ComboBox(self,
                                       self.ID_CATELIST,
                                       "",
                                       choices=[],
                                       size=(120, 20),
                                       style=wx.CB_READONLY)
        box1.Add(self.cmbCategory, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        #send button
        self.ID_SEND = wx.NewId()
        self.btnSend = wx.Button(self, self.ID_SEND, tr('Send'), size=(40, -1))
        box1.Add(self.btnSend, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        #site button
        self.ID_SITE = wx.NewId()
        self.btnSite = wx.Button(self, self.ID_SITE, tr('Site'), size=(40, -1))
        box1.Add(self.btnSite, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)

        #info button
        self.ID_INFO = wx.NewId()
        self.btnInfo = wx.Button(self, self.ID_INFO, tr('Info'), size=(40, -1))
        box1.Add(self.btnInfo, 0, wx.ALIGN_CENTER_VERTICAL, 2)

        box.Add(box1, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 2)

        #editor
        self.editor = TextEditor(self, self.mainframe.editctrl, self.filename,
                                 self.documenttype)

        box.Add(self.editor, 1, wx.ALL | wx.EXPAND, 0)

        self.load()

        self.SetSizer(box)
        self.SetAutoLayout(True)

        wx.EVT_BUTTON(self.btnSend, self.ID_SEND, self.OnSend)
        wx.EVT_BUTTON(self.btnSite, self.ID_SITE, self.OnSite)
        wx.EVT_BUTTON(self.btnInfo, self.ID_INFO, self.OnInfo)
        wx.EVT_UPDATE_UI(self.cmbCategory, self.ID_CATELIST, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.btnSend, self.ID_SEND, self.OnUpdateUI)

        self.opened = True