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()
def OnAdd(self, event): dlg = Entry.MyFileEntry(self, tr("Interpreter Path"), tr("Enter the interpreter path"), '') answer = dlg.ShowModal() if answer == wx.ID_OK: path = dlg.GetValue() if len(path) > 0: i = self.list.GetItemCount() self.list.InsertStringItem(i, 'Change the description') self.list.SetStringItem(i, 1, path) self.list.EditLabel(i)
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
def __create_entries(self, header, rows, types): entries = [] # Consider each row for row in rows: # Save the original content temp_entry = Entry() for i in range(len(header)): # Create an instance of class defined of type defined in the types dict # As a parameter set the original value of the cell setattr(temp_entry, header[i], types[header[i]](header[i], row[i])) entries.append(temp_entry) return entries
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)
def OnModify(self, event): if self.list.GetSelectedItemCount() > 1: dlg = wx.MessageDialog(self, tr("You can select only one item"), tr("Modify Interpreter Path"), wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() return item = self.list.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED) dlg = Entry.MyFileEntry(self, tr("Interpreter Path"), tr("Enter the interpreter path"), self.getItemText(item)[1]) answer = dlg.ShowModal() if answer == wx.ID_OK: path = dlg.GetValue() if len(path) > 0: self.list.SetStringItem(item, 1, path)
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))
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()