-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -32,8 +32,8 @@ | ||
import os.path | import os.path | ||
|
|
||
import config | import config | ||
|
|||
import dialog | import dialog | ||
from dialog.dialogs import MessageDialog | |||
|
|
||
def get_xine_config_file(): | def get_xine_config_file(): | ||
""" | """ | ||
|
@@ -69,3 +69,42 @@ def get_xine_config_file(): | ||
outfile.close() | outfile.close() | ||
|
|
||
return config_file | return config_file | ||
|
|||
|
|||
def show_message(message, name='message', duration=None): | |||
This comment has been minimized.
Sorry, something went wrong.
charrea6
|
|||
""" | |||
Helper function that shows the skinnable osd message dialog | |||
@param message: message to be displayed | |||
@param name: name of the dialog used to load appropriate skin object | |||
Default is ’message’, ‘status’ is also available. | |||
See dialog/dialogs.py and osd skin definitions for available | |||
names/dialog types | |||
@param duration: duration the msg is displayed. Default is None which defaults | |||
to the standard duration of the MessageDialog, currently 3 secs | |||
0 will display indefinitely, until hide_message() is called | |||
In this cae caller is responsible for cleaning up, either hide | |||
and finish the dialog or call dialog.util.hide_message()! | |||
@return: instantiated MessageDialog object, needed for subsequent call | |||
to hide_message | |||
""" | |||
dialog = MessageDialog(message) | |||
dialog.name = name | |||
if duration is None: | |||
dialog.show() | |||
else: | |||
dialog.show(duration) | |||
|
|||
return dialog | |||
|
|||
|
|||
def hide_message(dialog): | |||
""" | |||
Helper function that hides and finishes the osd message dialog, | |||
created by show_dialog() | |||
@param dialog: dialog object returned previously by show_dialog() | |||
""" | |||
# check if we have a valid object and check the type too, in case | |||
# someone passed us wrong type, to prevent runtime errors. | |||
if dialog and isinstance(dialog, MessageDialog): | |||
dialog.hide() | |||
dialog.finish() | |||
This comment has been minimized.
Sorry, something went wrong.
charrea6
|
1 comment
on commit 37f4cd5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, only some comments on the use of the new dialogs.
Thanks for fixing the message dialog, but the status dialog should be reverted please.
When you want to indicate to the user that you're doing something and the user has to wait, use dialog.show_working_indicator().
When you want the user to confirm they've seen something, use dialog.show_alert()
When you just want the user to know something but not interrupt them, use dialog.show_message(). For example you may want to use this when a download has finished, as they probably don't want to interrupt what they are doing to close a box saying something has finished downloading...
Please revert these changes as status is a specific type of message dialog.
Message dialogs don't stop the user interacting with the rest of freevo