aboutsummaryrefslogtreecommitdiffstats
path: root/lvc/widgets
diff options
context:
space:
mode:
authorJesús Eduardo <heckyel@hyperbola.info>2018-01-13 13:53:58 -0500
committerJesús Eduardo <heckyel@hyperbola.info>2018-01-13 13:53:58 -0500
commit824c5e21363bd8b4aaaf00fb6ac87c7f38fb7322 (patch)
tree240b44fbeace319bb6299de1c8181def95d63f0e /lvc/widgets
parent42852f8418074566160ec2527cd3c5de370a102e (diff)
downloadlibrevideoconverter-824c5e21363bd8b4aaaf00fb6ac87c7f38fb7322.tar.lz
librevideoconverter-824c5e21363bd8b4aaaf00fb6ac87c7f38fb7322.tar.xz
librevideoconverter-824c5e21363bd8b4aaaf00fb6ac87c7f38fb7322.zip
pep8 en lvc/widgets/dialogs.py
Diffstat (limited to 'lvc/widgets')
-rw-r--r--lvc/widgets/dialogs.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/lvc/widgets/dialogs.py b/lvc/widgets/dialogs.py
index 1726ab9..b1fd27f 100644
--- a/lvc/widgets/dialogs.py
+++ b/lvc/widgets/dialogs.py
@@ -42,13 +42,17 @@ difference is that all of the dialogs run modally.
from lvc.widgets import widgetset
from lvc.widgets import widgetutil
+
class DialogButton(object):
def __init__(self, text):
self._text = text
+
def __eq__(self, other):
return isinstance(other, DialogButton) and self.text == other.text
+
def __str__(self):
return "DialogButton(%r)" % self.text
+
@property
def text(self):
return unicode(self._text)
@@ -87,16 +91,14 @@ BUTTON_NOT_NOW = DialogButton("Not Now")
BUTTON_CLOSE_TO_TRAY = DialogButton("Close to Tray")
BUTTON_LAUNCH_MIRO = DialogButton("Launch LVC")
BUTTON_DOWNLOAD_ANYWAY = DialogButton("Download Anyway")
-BUTTON_OPEN_IN_EXTERNAL_BROWSER = DialogButton(
- "Open in External Browser")
+BUTTON_OPEN_IN_EXTERNAL_BROWSER = DialogButton("Open in External Browser")
BUTTON_DONT_INSTALL = DialogButton("Don't Install")
BUTTON_SUBSCRIBE = DialogButton("Subscribe")
BUTTON_STOP_WATCHING = DialogButton("Stop Watching")
BUTTON_RETRY = DialogButton("Retry")
BUTTON_START_FRESH = DialogButton("Start Fresh")
BUTTON_INCLUDE_DATABASE = DialogButton("Include Database")
-BUTTON_DONT_INCLUDE_DATABASE = DialogButton(
- "Don't Include Database")
+BUTTON_DONT_INCLUDE_DATABASE = DialogButton("Don't Include Database")
WARNING_MESSAGE = 0
INFO_MESSAGE = 1
@@ -122,6 +124,7 @@ class ProgressDialog(widgetset.Dialog):
else:
self.progress_bar.start_pulsing()
+
class DBUpgradeProgressDialog(widgetset.Dialog):
def __init__(self, title, text):
widgetset.Dialog.__init__(self, title)
@@ -141,6 +144,7 @@ class DBUpgradeProgressDialog(widgetset.Dialog):
self.label.set_text(stage)
self.progress_bar.set_progress(progress)
+
def show_about():
window = widgetset.AboutDialog()
set_transient_for_main(window)
@@ -149,8 +153,9 @@ def show_about():
finally:
window.destroy()
+
def show_message(title, description, alert_type=INFO_MESSAGE,
- transient_for=None):
+ transient_for=None):
"""Display a message to the user and wait for them to click OK"""
window = widgetset.AlertDialog(title, description, alert_type)
_set_transient_for(window, transient_for)
@@ -160,6 +165,7 @@ def show_message(title, description, alert_type=INFO_MESSAGE,
finally:
window.destroy()
+
def show_choice_dialog(title, description, choices, transient_for=None):
"""Display a message to the user and wait for them to choose an option.
Returns the button object chosen."""
@@ -172,6 +178,7 @@ def show_choice_dialog(title, description, choices, transient_for=None):
finally:
window.destroy()
+
def ask_for_string(title, description, initial_text=None, transient_for=None):
"""Ask the user to enter a string in a TextEntry box.
@@ -199,6 +206,7 @@ def ask_for_string(title, description, initial_text=None, transient_for=None):
finally:
window.destroy()
+
def ask_for_choice(title, description, choices):
"""Ask the user to enter a string in a TextEntry box.
@@ -221,8 +229,9 @@ def ask_for_choice(title, description, choices):
finally:
window.destroy()
+
def ask_for_open_pathname(title, initial_filename=None, filters=[],
- transient_for=None, select_multiple=False):
+ transient_for=None, select_multiple=False):
"""Returns the file pathname or None.
"""
window = widgetset.FileOpenDialog(title)
@@ -246,6 +255,7 @@ def ask_for_open_pathname(title, initial_filename=None, filters=[],
finally:
window.destroy()
+
def ask_for_save_pathname(title, initial_filename=None, transient_for=None):
"""Returns the file pathname or None.
"""
@@ -260,6 +270,7 @@ def ask_for_save_pathname(title, initial_filename=None, transient_for=None):
finally:
window.destroy()
+
def ask_for_directory(title, initial_directory=None, transient_for=None):
"""Returns the directory pathname or None.
"""