diff options
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/gui/eip_status.py | 4 | ||||
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 67 | ||||
-rw-r--r-- | src/leap/bitmask/gui/preferenceswindow.py | 3 | ||||
-rw-r--r-- | src/leap/bitmask/gui/ui/eip_status.ui | 66 | ||||
-rw-r--r-- | src/leap/bitmask/gui/ui/login.ui | 4 | ||||
-rw-r--r-- | src/leap/bitmask/gui/ui/mainwindow.ui | 199 |
6 files changed, 135 insertions, 208 deletions
diff --git a/src/leap/bitmask/gui/eip_status.py b/src/leap/bitmask/gui/eip_status.py index 4b4d360f..92bb623e 100644 --- a/src/leap/bitmask/gui/eip_status.py +++ b/src/leap/bitmask/gui/eip_status.py @@ -41,8 +41,8 @@ class EIPStatusWidget(QtGui.QWidget): EIP Status widget that displays the current state of the EIP service """ DISPLAY_TRAFFIC_RATES = True - RATE_STR = "%14.2f KB/s" - TOTAL_STR = "%14.2f Kb" + RATE_STR = "%1.2f KB/s" + TOTAL_STR = "%1.2f Kb" eip_connection_connected = QtCore.Signal() diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 929919ac..1c80cce8 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -248,6 +248,8 @@ class MainWindow(QtGui.QMainWindow): self._soledad_bootstrapper.soledad_failed.connect( self._mail_status.set_soledad_failed) + self.ui.action_preferences.triggered.connect(self._show_preferences) + self.ui.action_eip_preferences.triggered.connect(self._show_eip_preferences) self.ui.action_about_leap.triggered.connect(self._about) self.ui.action_quit.triggered.connect(self.quit) self.ui.action_wizard.triggered.connect(self._launch_wizard) @@ -279,8 +281,9 @@ class MainWindow(QtGui.QMainWindow): self._action_visible = QtGui.QAction(self.tr("Hide Main Window"), self) self._action_visible.triggered.connect(self._toggle_visible) - self.ui.btnPreferences.clicked.connect(self._show_preferences) - self.ui.btnEIPPreferences.clicked.connect(self._show_eip_preferences) + # disable buttons for now, may come back later. + # self.ui.btnPreferences.clicked.connect(self._show_preferences) + # self.ui.btnEIPPreferences.clicked.connect(self._show_eip_preferences) self._enabled_services = [] @@ -467,22 +470,61 @@ class MainWindow(QtGui.QMainWindow): """ SLOT TRIGGERS: - self.ui.btnPreferences.clicked + self.ui.btnPreferences.clicked (disabled for now) + self.ui.action_preferences Displays the preferences window. """ - preferences_window = PreferencesWindow( + preferences = PreferencesWindow( self, self._srp_auth, self._provider_config, self._soledad, self._login_widget.get_selected_provider()) - self.soledad_ready.connect(preferences_window.set_soledad_ready) - preferences_window.show() + self.soledad_ready.connect(preferences.set_soledad_ready) + preferences.show() + preferences.preferences_saved.connect(self._update_eip_enabled_status) + + def _update_eip_enabled_status(self): + """ + SLOT + TRIGGER: + PreferencesWindow.preferences_saved + + Enable or disable the EIP start/stop actions and stop EIP if the user + disabled that service. + + :returns: if the eip actions were enabled or disabled + :rtype: bool + """ + settings = self._settings + default_provider = settings.get_defaultprovider() + enabled_services = [] + if default_provider is not None: + enabled_services = settings.get_enabled_services(default_provider) + + eip_enabled = False + if EIP_SERVICE in enabled_services: + should_autostart = settings.get_autostart_eip() + if should_autostart and default_provider is not None: + self._eip_status.enable_eip_start() + self._eip_status.set_eip_status("") + eip_enabled = True + else: + # we don't have an usable provider + # so the user needs to log in first + self._eip_status.disable_eip_start() + else: + self._stop_eip() + self._eip_status.disable_eip_start() + self._eip_status.set_eip_status(self.tr("Disabled")) + + return eip_enabled def _show_eip_preferences(self): """ SLOT TRIGGERS: self.ui.btnEIPPreferences.clicked + self.ui.action_eip_preferences (disabled for now) Displays the EIP preferences window. """ @@ -1177,21 +1219,10 @@ class MainWindow(QtGui.QMainWindow): """ settings = self._settings - should_autostart = settings.get_autostart_eip() - if not should_autostart: - logger.debug('Will not autostart EIP since it is setup ' - 'to not to do it') - self.eip_needs_login.emit() + if not self._update_eip_enabled_status(): return default_provider = settings.get_defaultprovider() - - if default_provider is None: - logger.info("Cannot autostart Encrypted Internet because there is " - "no default provider configured") - self.eip_needs_login.emit() - return - self._enabled_services = settings.get_enabled_services( default_provider) diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index b4bddef2..517a90c4 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -42,6 +42,8 @@ class PreferencesWindow(QtGui.QDialog): """ Window that displays the preferences. """ + preferences_saved = QtCore.Signal() + def __init__(self, parent, srp_auth, provider_config, soledad, domain): """ :param parent: parent object of the PreferencesWindow. @@ -369,6 +371,7 @@ class PreferencesWindow(QtGui.QDialog): "Services settings for provider '{0}' saved.".format(provider)) logger.debug(msg) self._set_providers_services_status(msg, success=True) + self.preferences_saved.emit() def _get_provider_config(self, domain): """ diff --git a/src/leap/bitmask/gui/ui/eip_status.ui b/src/leap/bitmask/gui/ui/eip_status.ui index d078ca0c..64821ad6 100644 --- a/src/leap/bitmask/gui/ui/eip_status.ui +++ b/src/leap/bitmask/gui/ui/eip_status.ui @@ -25,6 +25,9 @@ </property> <item> <layout class="QGridLayout" name="gridLayout"> + <property name="verticalSpacing"> + <number>0</number> + </property> <item row="0" column="2"> <widget class="QPushButton" name="btnEipStartStop"> <property name="text"> @@ -75,13 +78,6 @@ <verstretch>0</verstretch> </sizepolicy> </property> - <property name="font"> - <font> - <pointsize>14</pointsize> - <weight>75</weight> - <bold>true</bold> - </font> - </property> <property name="text"> <string>Traffic is being routed in the clear</string> </property> @@ -124,12 +120,6 @@ </item> <item row="2" column="1" colspan="3"> <widget class="QWidget" name="eip_bandwidth" native="true"> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>32</height> - </size> - </property> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>0</number> @@ -146,16 +136,6 @@ <enum>QLayout::SetDefaultConstraint</enum> </property> <item> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="../../../../../data/resources/icons.qrc">:/images/light/16/down-arrow.png</pixmap> - </property> - </widget> - </item> - <item> <widget class="QPushButton" name="btnDownload"> <property name="sizePolicy"> <sizepolicy hsizetype="Maximum" vsizetype="Fixed"> @@ -175,25 +155,18 @@ <height>16777215</height> </size> </property> - <property name="font"> - <font> - <pointsize>11</pointsize> - <weight>75</weight> - <bold>true</bold> - </font> - </property> <property name="cursor"> <cursorShape>PointingHandCursor</cursorShape> </property> - <property name="styleSheet"> - <string notr="true">text-align: left;</string> - </property> <property name="text"> <string>0.0 KB/s</string> </property> <property name="flat"> <bool>true</bool> </property> + <property name="icon"> + <pixmap resource="../../../../../data/resources/icons.qrc">:/images/light/16/down-arrow.png</pixmap> + </property> </widget> </item> <item> @@ -206,22 +179,12 @@ </property> <property name="sizeHint" stdset="0"> <size> - <width>10</width> + <width>20</width> <height>20</height> </size> </property> </spacer> </item> - <item> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="../../../../../data/resources/icons.qrc">:/images/light/16/up-arrow.png</pixmap> - </property> - </widget> - </item> <item alignment="Qt::AlignLeft"> <widget class="QPushButton" name="btnUpload"> <property name="sizePolicy"> @@ -242,25 +205,18 @@ <height>16777215</height> </size> </property> - <property name="font"> - <font> - <pointsize>11</pointsize> - <weight>75</weight> - <bold>true</bold> - </font> - </property> <property name="cursor"> <cursorShape>PointingHandCursor</cursorShape> </property> - <property name="styleSheet"> - <string notr="true">text-align: left;</string> - </property> <property name="text"> <string>0.0 KB/s</string> </property> <property name="flat"> <bool>true</bool> </property> + <property name="icon"> + <pixmap resource="../../../../../data/resources/icons.qrc">:/images/light/16/up-arrow.png</pixmap> + </property> </widget> </item> <item> @@ -271,7 +227,7 @@ <property name="sizeHint" stdset="0"> <size> <width>0</width> - <height>20</height> + <height>0</height> </size> </property> </spacer> diff --git a/src/leap/bitmask/gui/ui/login.ui b/src/leap/bitmask/gui/ui/login.ui index e7ca1652..7e8f9daf 100644 --- a/src/leap/bitmask/gui/ui/login.ui +++ b/src/leap/bitmask/gui/ui/login.ui @@ -215,7 +215,7 @@ <number>0</number> </property> <property name="bottomMargin"> - <number>24</number> + <number>0</number> </property> <item row="1" column="1"> <spacer name="horizontalSpacer"> @@ -255,7 +255,7 @@ <widget class="QLabel" name="lblLoginStatus"> <property name="styleSheet"> <string notr="true">color: rgb(132, 132, 132); -font: 75 12pt "Lucida Grande";</string> +font: 75 12pt;</string> </property> <property name="text"> <string/> diff --git a/src/leap/bitmask/gui/ui/mainwindow.ui b/src/leap/bitmask/gui/ui/mainwindow.ui index 3b83788e..ce05f8f3 100644 --- a/src/leap/bitmask/gui/ui/mainwindow.ui +++ b/src/leap/bitmask/gui/ui/mainwindow.ui @@ -85,108 +85,8 @@ <property name="margin"> <number>0</number> </property> - <item> - <widget class="QWidget" name="eipWidget" native="true"> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>0</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QFrame" name="frame_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true">QFrame{background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(160, 160, 160, 128), stop:1 rgba(255, 255, 255, 0));}</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="leftMargin"> - <number>24</number> - </property> - <property name="rightMargin"> - <number>24</number> - </property> - <item> - <widget class="QLabel" name="label_2"> - <property name="font"> - <font> - <pointsize>16</pointsize> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="styleSheet"> - <string notr="true">background-color: rgba(255, 255, 255, 0);</string> - </property> - <property name="text"> - <string>Encrypted Internet</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnEIPPreferences"> - <property name="maximumSize"> - <size> - <width>48</width> - <height>20</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../../../../../data/resources/mainwindow.qrc"> - <normaloff>:/images/black/32/gear.png</normaloff>:/images/black/32/gear.png</iconset> - </property> - <property name="autoDefault"> - <bool>false</bool> - </property> - <property name="default"> - <bool>false</bool> - </property> - <property name="flat"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="eipLayout"> - <property name="leftMargin"> - <number>12</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>12</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> + + <!-- LOGIN --> <item> <widget class="QFrame" name="frame"> <property name="sizePolicy"> @@ -199,9 +99,7 @@ <bool>false</bool> </property> <property name="styleSheet"> - <string notr="true">QFrame{ -background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgba(160, 160, 160, 128), stop:1 rgba(255, 255, 255, 0)); -}</string> + <string notr="true">background-color: rgba(0,0,0,20); border-bottom: 1px solid rgba(0,0,0,30);</string> </property> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="leftMargin"> @@ -214,36 +112,15 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb <widget class="QLabel" name="lblLoginProvider"> <property name="font"> <font> - <pointsize>16</pointsize> <weight>75</weight> <bold>true</bold> </font> </property> <property name="styleSheet"> - <string notr="true">background-color: rgba(255, 255, 255, 0);</string> - </property> - <property name="text"> - <string>Login</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnPreferences"> - <property name="maximumSize"> - <size> - <width>48</width> - <height>20</height> - </size> - </property> - <property name="styleSheet"> - <string notr="true"/> + <string notr="true">background-color: rgba(255, 255, 255, 0); border: none;</string> </property> <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../../../../../data/resources/mainwindow.qrc"> - <normaloff>:/images/black/32/gear.png</normaloff>:/images/black/32/gear.png</iconset> + <string>Please Log In</string> </property> </widget> </item> @@ -257,13 +134,54 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb </property> </layout> </item> + <item> - <widget class="Line" name="line_2"> + <widget class="Line" name="lineUnderLogin"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> + + <!-- EIP --> + <item> + <widget class="QWidget" name="eipWidget" native="true"> + <layout class="QVBoxLayout" name="eipVerticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <layout class="QVBoxLayout" name="eipLayout"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + </layout> + </item> + </layout> + </widget> + </item> + + <item> + <widget class="Line" name="lineUnderEIP"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + + <!-- EMAIL --> <item> <widget class="QWidget" name="mailWidget" native="true"> <layout class="QVBoxLayout" name="verticalLayout_3"> @@ -286,6 +204,15 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb </layout> </widget> </item> + + <item> + <widget class="Line" name="lineUnderEmail"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> <spacer name="verticalSpacer"> <property name="orientation"> @@ -390,6 +317,9 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb <addaction name="action_create_new_account"/> <addaction name="action_advanced_key_management"/> <addaction name="separator"/> + <addaction name="action_preferences"/> + <addaction name="action_eip_preferences"/> + <addaction name="separator"/> <addaction name="action_quit"/> </widget> <widget class="QMenu" name="menuHelp"> @@ -404,10 +334,17 @@ background-color: qlineargradient(spread:pad, x1:0, y1:1, x2:0, y2:0, stop:0 rgb <addaction name="menuFile"/> <addaction name="menuHelp"/> </widget> - <widget class="QStatusBar" name="statusbar"/> <action name="action_preferences"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Account Preferences...</string> + </property> + </action> + <action name="action_eip_preferences"> <property name="text"> - <string>Preferences...</string> + <string>Internet Preferences...</string> </property> </action> <action name="action_quit"> |