pyworkflow.gui.text module

Text based widgets.

class pyworkflow.gui.text.HyperlinkManager(text)[source]

Bases: object

Tkinter Text Widget Hyperlink Manager, taken from: http://effbot.org/zone/tkinter-text-hyperlink.htm

add(action)[source]
reset()[source]
class pyworkflow.gui.text.OutputText(master, filename, colors=True, t_refresh=0, maxSize=400, **opts)[source]

Bases: Text

Implement a Text that will show file content and handle console metacharacter for colored output

colors flag indicate if try to parse color meta-characters t_refresh is the refresh time in seconds, 0 means no refresh

addLine(line)[source]

Should be implemented to add a line

configureTags()[source]

This should be implemented to create specific tags

doRefresh()[source]
getDefaults()[source]

This should be implemented in subclasses to provide defaults

readFile(clear=False)[source]
class pyworkflow.gui.text.TaggedText(master, colors=True, **opts)[source]

Bases: Text

Implement a Text that will recognize some basic tags some_text will display some_text in bold _some_text_ will display some_text in italic some_link or [[some_link][some_label]] will display some_link

as hyperlink or some_label as hyperlink to some_link

also colors are recognized if set option colors=True

Construct a text widget with the parent MASTER.

STANDARD OPTIONS

background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, padx, pady, relief, selectbackground, selectborderwidth, selectforeground, setgrid, takefocus, xscrollcommand, yscrollcommand,

WIDGET-SPECIFIC OPTIONS

autoseparators, height, maxundo, spacing1, spacing2, spacing3, state, tabs, undo, width, wrap,

addLine(line)[source]

Should be implemented to add a line

configureTags()[source]

This should be implemented to create specific tags

getDefaults()[source]

This should be implemented in subclasses to provide defaults

static mailTo(email)[source]
matchHyperText(match, tag)[source]

Process when a match a found and store indexes inside string.

class pyworkflow.gui.text.Text(master, **opts)[source]

Bases: Text, Scrollable

Base Text widget with some functionality that will be used by children classes.

Construct a text widget with the parent MASTER.

STANDARD OPTIONS

background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, insertofftime, insertontime, insertwidth, padx, pady, relief, selectbackground, selectborderwidth, selectforeground, setgrid, takefocus, xscrollcommand, yscrollcommand,

WIDGET-SPECIFIC OPTIONS

autoseparators, height, maxundo, spacing1, spacing2, spacing3, state, tabs, undo, width, wrap,

addLine(line)[source]

Should be implemented to add a line

addNewline()[source]
addText(text)[source]

Add some text to the current state.

clear()[source]
configureTags()[source]

This should be implemented to create specific tags

copyToClipboard(e=None)[source]
getDefaults()[source]

This should be implemented in subclasses to provide defaults

getText()[source]
goBegin()[source]
goEnd()[source]
highlight(pattern, tag, start='1.0', end='end', regexp=False)[source]

Apply the given tag to all text that matches the given pattern

If ‘regexp’ is set to True, pattern will be treated as a regular expression Taken from:

isAtEnd()[source]
onClick(e=None)[source]
onRightClick(e)[source]
openFile()[source]
openPath(path)[source]

Try to open the selected path

setReadOnly(value)[source]
setText(text)[source]

Replace the current text with new one.

updateMenu(e=None)[source]
class pyworkflow.gui.text.TextFileViewer(master, fileList=[], allowSearch=True, allowRefresh=True, allowOpen=False, font=None, maxSize=400, width=100, height=30)[source]

Bases: Frame

Implementation of a simple text file viewer

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

addBinding()[source]
addFile(filename)[source]
buildSearchList(text, str, matchCase=0)[source]
changeFont(event='')[source]
changePosition(index)[source]
clear()[source]

Remove all added files.

createWidgets(fileList)[source]
findPrevText()[source]
findText(direction=1, matchCase=0)[source]
getIndex()[source]

Return the index of the selected tab.

modifyFontSize(newSize)[source]
nextSearchIndex(text, direction=1)[source]
refreshAll(clear=False, goEnd=False)[source]

Refresh all output textareas.

refreshOutput(e=None)[source]
selectedText()[source]
setIndex(index)[source]

Select the tab with the given index.

pyworkflow.gui.text.configureColorTags(text)[source]

Create tags in text (of type tk.Text) for all the supported colors.

pyworkflow.gui.text.find_prog(*args)[source]

Return the first argument that is a program in PATH

pyworkflow.gui.text.openTextFile(filename)[source]

Open a text file with an external or default viewer.

pyworkflow.gui.text.openTextFileEditor(filename, tkParent=None)[source]
pyworkflow.gui.text.showTextFileViewer(title, filelist, parent=None, main=False)[source]