~ubuntu-branches/ubuntu/oneiric/ubuntuone-control-panel/oneiric

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/gui.py

* New upstream release:
  [ Alejandro J. Cura <alecu@canonical.com>]
    - Do not throw a webclient error when closing
      (LP: #845105).
  [ Natalia B. Bidart <natalia.bidart@canonical.com> ]
    - Removed all code related to Bookmarks (LP: #850142).
    - Replaces references to "Evolution" by "Thunderbird" (LP: #849494).
  [ Rodney Dawes <rodney.dawes@canonical.com> ]
    - Don't install a .desktop file for control panel
      (part of LP: #838778).
    - Point the indicator/Unity API at the installer .desktop file
      (part of LP: #838778).
    - Set the WMCLASS so Unity will fall back properly
      (part of LP: #838778).
    - Fix a few grammar mistakes (LP: #835093).
    - Don't show the "Get NGB free!" label on "Join now" button at all
      (LP: #819955).
* debian/control:
  - ubuntuone-control-panel-gtk depends now on ubuntuone-installer >= 2.0.0.
  - require ubuntuone-client >= 2.0.0.
  - require ubuntu-sso-client >= 1.4.0.
  - no longer install a .desktop file (will be installed by ubuntuone-installer).

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from PyQt4 import QtGui
23
23
 
24
 
from ubuntuone.controlpanel.logger import setup_logging
 
24
from ubuntuone.controlpanel.gui.qt.systray import TrayIcon
25
25
from ubuntuone.controlpanel.gui.qt.ui import mainwindow_ui
26
26
 
27
27
 
28
 
logger = setup_logging('qt.gui')
29
 
 
30
 
 
31
28
class MainWindow(QtGui.QMainWindow):
32
29
    """The Main Window of the Control Panel."""
33
30
 
34
31
    def __init__(self, close_callback=None):
35
32
        """Initialize this instance with the UI layout."""
36
 
        QtGui.QMainWindow.__init__(self)
 
33
        super(MainWindow, self).__init__()
37
34
        self.ui = mainwindow_ui.Ui_MainWindow()
38
35
        self.ui.setupUi(self)
39
36
        self.close_callback = close_callback
 
37
        self._setup()
 
38
 
 
39
    def _setup(self):
 
40
        """Do some extra setupping for the UI."""
 
41
        self.ui.control_panel.ui.signin.signinCanceled.connect(self.close)
40
42
 
41
43
    # Invalid name "closeEvent"
42
44
    # pylint: disable=C0103
46
48
        if self.close_callback is not None:
47
49
            self.close_callback()
48
50
        event.accept()
 
51
 
 
52
    # pylint: enable=C0103
 
53
 
 
54
 
 
55
def start(stop, minimized=False, with_icon=False):
 
56
    """Show the UI elements."""
 
57
    # pylint: disable=W0404, F0401
 
58
    if not minimized:
 
59
        if with_icon or minimized:
 
60
            window = MainWindow()
 
61
        else:
 
62
            window = MainWindow(close_callback=stop)
 
63
        window.show()
 
64
    else:
 
65
        window = None
 
66
    if with_icon or minimized:
 
67
        QtGui.QApplication.instance().setQuitOnLastWindowClosed(False)
 
68
        icon = TrayIcon(window=window)
 
69
    else:
 
70
        icon = None
 
71
    return icon, window