-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: move imports in about.py to top of file ui: move imports to top of notify.py ui: move imports to top of window.py ui: reorder imports at beginning of __init__.py ui: move imports to top of tray.py ui: move common code out of __init__.py to common.py ui: move imports to top of __init___.py
- Loading branch information
Showing
9 changed files
with
106 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# -*- python-mode -*- | ||
|
||
## Copyright (C) 2012-2013 Daniel Pavel | ||
## | ||
## This program is free software; you can redistribute it and/or modify | ||
## it under the terms of the GNU General Public License as published by | ||
## the Free Software Foundation; either version 2 of the License, or | ||
## (at your option) any later version. | ||
## | ||
## This program is distributed in the hope that it will be useful, | ||
## but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
## GNU General Public License for more details. | ||
## | ||
## You should have received a copy of the GNU General Public License along | ||
## with this program; if not, write to the Free Software Foundation, Inc., | ||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
import logging | ||
|
||
from gi.repository import GLib, Gtk | ||
from solaar.i18n import _ | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def _error_dialog(reason, object): | ||
logger.error('error: %s %s', reason, object) | ||
|
||
if reason == 'permissions': | ||
title = _('Permissions error') | ||
text = ( | ||
_('Found a Logitech receiver or device (%s), but did not have permission to open it.') % object + '\n\n' + | ||
_("If you've just installed Solaar, try disconnecting the receiver or device and then reconnecting it.") | ||
) | ||
elif reason == 'nodevice': | ||
title = _('Cannot connect to device error') | ||
text = ( | ||
_('Found a Logitech receiver or device at %s, but encountered an error connecting to it.') % object + '\n\n' + | ||
_('Try disconnecting the device and then reconnecting it or turning it off and then on.') | ||
) | ||
elif reason == 'unpair': | ||
title = _('Unpairing failed') | ||
text = ( | ||
_('Failed to unpair %{device} from %{receiver}.').format(device=object.name, receiver=object.receiver.name) + | ||
'\n\n' + _('The receiver returned an error, with no further details.') | ||
) | ||
else: | ||
raise Exception("ui.error_dialog: don't know how to handle (%s, %s)", reason, object) | ||
|
||
assert title | ||
assert text | ||
|
||
m = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, text) | ||
m.set_title(title) | ||
m.run() | ||
m.destroy() | ||
|
||
|
||
def error_dialog(reason, object): | ||
assert reason is not None | ||
GLib.idle_add(_error_dialog, reason, object) | ||
|
||
|
||
# | ||
# | ||
# | ||
|
||
task_runner = None | ||
|
||
|
||
def ui_async(function, *args, **kwargs): | ||
if task_runner: | ||
task_runner(function, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters