summaryrefslogtreecommitdiff
path: root/grc/gui/Dialogs.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui/Dialogs.py')
-rw-r--r--grc/gui/Dialogs.py130
1 files changed, 65 insertions, 65 deletions
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
index df424750b9..5b3b420d3b 100644
--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -23,46 +23,46 @@ import gtk
import Utils
class TextDisplay(gtk.TextView):
- """A non editable gtk text view."""
-
- def __init__(self, text=''):
- """
- TextDisplay constructor.
-
- Args:
- text: the text to display (string)
- """
- text_buffer = gtk.TextBuffer()
- text_buffer.set_text(text)
- self.set_text = text_buffer.set_text
- self.insert = lambda line: text_buffer.insert(text_buffer.get_end_iter(), line)
- gtk.TextView.__init__(self, text_buffer)
- self.set_editable(False)
- self.set_cursor_visible(False)
- self.set_wrap_mode(gtk.WRAP_WORD_CHAR)
+ """A non editable gtk text view."""
+
+ def __init__(self, text=''):
+ """
+ TextDisplay constructor.
+
+ Args:
+ text: the text to display (string)
+ """
+ text_buffer = gtk.TextBuffer()
+ text_buffer.set_text(text)
+ self.set_text = text_buffer.set_text
+ self.insert = lambda line: text_buffer.insert(text_buffer.get_end_iter(), line)
+ gtk.TextView.__init__(self, text_buffer)
+ self.set_editable(False)
+ self.set_cursor_visible(False)
+ self.set_wrap_mode(gtk.WRAP_WORD_CHAR)
def MessageDialogHelper(type, buttons, title=None, markup=None):
- """
- Create a modal message dialog and run it.
-
- Args:
- type: the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING, gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
- buttons: the predefined set of buttons to use:
- gtk.BUTTONS_NONE, gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, gtk.BUTTONS_OK_CANCEL
-
- Args:
- tittle: the title of the window (string)
- markup: the message text with pango markup
-
- Returns:
- the gtk response from run()
- """
- message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type, buttons)
- if title: message_dialog.set_title(title)
- if markup: message_dialog.set_markup(markup)
- response = message_dialog.run()
- message_dialog.destroy()
- return response
+ """
+ Create a modal message dialog and run it.
+
+ Args:
+ type: the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING, gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
+ buttons: the predefined set of buttons to use:
+ gtk.BUTTONS_NONE, gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, gtk.BUTTONS_OK_CANCEL
+
+ Args:
+ tittle: the title of the window (string)
+ markup: the message text with pango markup
+
+ Returns:
+ the gtk response from run()
+ """
+ message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type, buttons)
+ if title: message_dialog.set_title(title)
+ if markup: message_dialog.set_markup(markup)
+ response = message_dialog.run()
+ message_dialog.destroy()
+ return response
ERRORS_MARKUP_TMPL="""\
@@ -72,31 +72,31 @@ $encode($err_msg.replace('\t', ' '))
#end for"""
def ErrorsDialog(flowgraph): MessageDialogHelper(
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_CLOSE,
- title='Flow Graph Errors',
- markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
+ type=gtk.MESSAGE_ERROR,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Flow Graph Errors',
+ markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
)
class AboutDialog(gtk.AboutDialog):
- """A cute little about dialog."""
-
- def __init__(self, platform):
- """AboutDialog constructor."""
- gtk.AboutDialog.__init__(self)
- self.set_name(platform.get_name())
- self.set_version(platform.get_version())
- self.set_license(platform.get_license())
- self.set_copyright(platform.get_license().splitlines()[0])
- self.set_website(platform.get_website())
- self.run()
- self.destroy()
+ """A cute little about dialog."""
+
+ def __init__(self, platform):
+ """AboutDialog constructor."""
+ gtk.AboutDialog.__init__(self)
+ self.set_name(platform.get_name())
+ self.set_version(platform.get_version())
+ self.set_license(platform.get_license())
+ self.set_copyright(platform.get_license().splitlines()[0])
+ self.set_website(platform.get_website())
+ self.run()
+ self.destroy()
def HelpDialog(): MessageDialogHelper(
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_CLOSE,
- title='Help',
- markup="""\
+ type=gtk.MESSAGE_INFO,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Help',
+ markup="""\
<b>Usage Tips</b>
<u>Add block</u>: drag and drop or double click a block in the block selection window.
@@ -112,15 +112,15 @@ COLORS_DIALOG_MARKUP_TMPL = """\
<b>Color Mapping</b>
#if $colors
- #set $max_len = max([len(color[0]) for color in $colors]) + 10
- #for $title, $color_spec in $colors
+ #set $max_len = max([len(color[0]) for color in $colors]) + 10
+ #for $title, $color_spec in $colors
<span background="$color_spec"><tt>$($encode($title).center($max_len))</tt></span>
- #end for
+ #end for
#end if
"""
def TypesDialog(platform): MessageDialogHelper(
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_CLOSE,
- title='Types',
- markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL, colors=platform.get_colors()))
+ type=gtk.MESSAGE_INFO,
+ buttons=gtk.BUTTONS_CLOSE,
+ title='Types',
+ markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL, colors=platform.get_colors()))