summaryrefslogtreecommitdiff
path: root/src/leap/gui
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-11-21 06:15:41 +0900
committerkali <kali@leap.se>2012-11-21 06:15:41 +0900
commit53c6c92e26970de7de0bddca0034e72af7d0ce48 (patch)
tree141fedb84ecc5ffe0e14e873ce6fe3a0d3ec4de3 /src/leap/gui
parent8ad4957531f5279cf65df36b015d83443deded33 (diff)
add red border to failed field
Diffstat (limited to 'src/leap/gui')
-rw-r--r--src/leap/gui/firstrun/providerselect.py11
-rw-r--r--src/leap/gui/progress.py1
-rw-r--r--src/leap/gui/styles.py17
3 files changed, 27 insertions, 2 deletions
diff --git a/src/leap/gui/firstrun/providerselect.py b/src/leap/gui/firstrun/providerselect.py
index b6482379..2786c494 100644
--- a/src/leap/gui/firstrun/providerselect.py
+++ b/src/leap/gui/firstrun/providerselect.py
@@ -12,7 +12,7 @@ from leap.base import exceptions as baseexceptions
from leap.gui.constants import APP_LOGO
from leap.gui.progress import InlineValidationPage
-from leap.gui.styles import ErrorLabelStyleSheet
+from leap.gui import styles
from leap.util.web import get_https_domain_and_port
logger = logging.getLogger(__name__)
@@ -70,7 +70,7 @@ class SelectProviderPage(InlineValidationPage):
#self.registerField('provider_name_index', providerNameSelect)
validationMsg = QtGui.QLabel("")
- validationMsg.setStyleSheet(ErrorLabelStyleSheet)
+ validationMsg.setStyleSheet(styles.ErrorLabelStyleSheet)
self.validationMsg = validationMsg
providerCheckButton = QtGui.QPushButton(self.tr("chec&k"))
self.providerCheckButton = providerCheckButton
@@ -284,11 +284,16 @@ class SelectProviderPage(InlineValidationPage):
bad_str = getattr(self, 'bad_string', None)
cur_str = self.providerNameEdit.text()
showerr = self.validationMsg.setText
+ markred = lambda: self.providerNameEdit.setStyleSheet(
+ styles.ErrorLineEdit)
+ umarkrd = lambda: self.providerNameEdit.setStyleSheet(
+ styles.RegularLineEdit)
if bad_str is None:
# first time we fall here.
# save the current bad_string value
self.bad_string = cur_str
showerr(errors)
+ markred()
else:
# not the first time
# XXX hey, this is getting convoluted.
@@ -298,9 +303,11 @@ class SelectProviderPage(InlineValidationPage):
# enter a domain.
if cur_str == bad_str:
showerr(errors)
+ markred()
else:
if not getattr(self, 'domain_checked', None):
showerr('')
+ umarkrd()
else:
self.bad_string = cur_str
showerr(errors)
diff --git a/src/leap/gui/progress.py b/src/leap/gui/progress.py
index 10d19207..33b0cb8c 100644
--- a/src/leap/gui/progress.py
+++ b/src/leap/gui/progress.py
@@ -369,6 +369,7 @@ class ValidationPage(QtGui.QWizardPage, WithStepsMixIn):
self.checks.begin()
#logger.debug('check thread started!')
#logger.debug('waiting for it to terminate...')
+ # XXX needed for it to join?
self.checks.wait()
def show_progress(self):
diff --git a/src/leap/gui/styles.py b/src/leap/gui/styles.py
index 759817ce..18c0ac97 100644
--- a/src/leap/gui/styles.py
+++ b/src/leap/gui/styles.py
@@ -2,3 +2,20 @@ ErrorLabelStyleSheet = """
QLabel { color: red;
font-weight: bold}
"""
+
+ErrorLineEdit = """
+QLineEdit {
+ border: 1px solid red;
+}
+"""
+
+# XXX this is bad.
+# and you should feel bad for it.
+# The original style has a sort of box color
+# white/beige left-top/right-bottom or something like
+# that.
+RegularLineEdit = """
+QLineEdit {
+ border: 1px solid black;
+}
+"""