Ejemplo n.º 1
0
def OnEditFormatUncomment(win, event):
    if win.pref.show_comment_chars_dialog:
        from modules import Entry

        dlg = Entry.MyTextEntry(win, tr("Comment..."), tr("Comment Char:"),
                                get_document_comment_chars(win.document))
        answer = dlg.ShowModal()
        if answer == wx.ID_OK:
            commentchar = dlg.GetValue()
            if len(commentchar) == 0:
                return
        else:
            return
    else:
        commentchar = get_document_comment_chars(win.document)
    win.pref.last_comment_chars = commentchar
    win.pref.save()
    win.document.BeginUndoAction()
    len_cm = len(commentchar)
    for i in win.document.getSelectionLines():
        start = win.document.PositionFromLine(i)
        text = win.document.getLineText(i)
        if text.startswith(commentchar):
            win.document.removeText(start, len_cm)
    win.document.EndUndoAction()
Ejemplo n.º 2
0
    def OnGetPostsMore(self, event):
        from modules import Entry

        dlg = Entry.MyTextEntry(self, tr("Get Recent Posts"), tr("Enter the number from the lastest one:"), '1')
        answer = dlg.ShowModal()
        if answer == wx.ID_OK:
            try:
                number = int(dlg.GetValue())
                self.getposts(number)
            except:
                return
Ejemplo n.º 3
0
def OnSearchGotoLine(win, event):
    from modules import Entry
    document = win.document

    line = document.GetCurrentLine() + 1
    dlg = Entry.MyTextEntry(win, tr("Go To Line"),
                            tr("Enter the line number:"), str(line))
    answer = dlg.ShowModal()
    if answer == wx.ID_OK:
        try:
            line = int(dlg.GetValue())
        except:
            return
        else:
            document.goto(line)
Ejemplo n.º 4
0
def OnCreatePythonPackage(dirwin, event):
    item = dirwin.tree.GetSelection()
    if not item.IsOk(): return
    dir = common.getCurrentDir(dirwin.get_node_filename(item))

    from modules import Entry
    dlg = Entry.MyTextEntry(Globals.mainframe, tr('Input Directory Name'),
                            tr('Input Directory Name'))
    path = ''
    if dlg.ShowModal() == wx.ID_OK:
        path = dlg.GetValue()
    dlg.Destroy()

    path = os.path.join(dir, path)
    if not os.path.exists(path):
        try:
            os.makedirs(path)
        except Exception, e:
            common.showerror(str(e))
Ejemplo n.º 5
0
def OnEditFormatComment(win, event):
    if win.pref.show_comment_chars_dialog:
        from modules import Entry

        dlg = Entry.MyTextEntry(win, tr("Comment Writer"), tr("Comment:"), get_document_comment_chars(win.document))
        answer = dlg.ShowModal()
        if answer == wx.ID_OK:
            commentchar = dlg.GetValue()
            if len(commentchar) == 0:
                return
        else:
            return
    else:
        commentchar = get_document_comment_chars(win.document)
    win.pref.last_comment_chars = commentchar
    win.pref.save()
    win.document.BeginUndoAction()
    for i in win.document.getSelectionLines():
        start = win.document.PositionFromLine(i)
        win.document.InsertText(start, commentchar)
    win.document.EndUndoAction()