summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile14
-rw-r--r--changes/bug-5048_version-checks-in-wizard1
-rw-r--r--changes/feature_nice-process1
-rwxr-xr-xpkg/scripts/monitor_resource.zsh26
-rw-r--r--src/leap/bitmask/app.py5
-rw-r--r--src/leap/bitmask/gui/ui/wizard.ui73
-rw-r--r--src/leap/bitmask/gui/wizard.py11
8 files changed, 98 insertions, 35 deletions
diff --git a/.gitignore b/.gitignore
index eb44f637..e4b03d7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.log
*.lprof
*.pstats
+*.data
*.*~
.*
*_rc.py
@@ -33,3 +34,4 @@ config/*
CHANGELOG~
data/bitmask.pro
+bitmask-resources.png
diff --git a/Makefile b/Makefile
index 25d2bcf5..cb1f8218 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,10 @@ ifndef EDITOR
export EDITOR=vim
endif
+ifndef RESOURCE_TIME
+ export RESOURCE_TIME=10
+endif
+
#
all : resources ui
@@ -72,10 +76,18 @@ mailprofile:
gprof2dot -f pstats /tmp/leap_mail_profile.pstats -n 0.2 -e 0.2 | dot -Tpdf -o /tmp/leap_mail_profile.pdf
do_lineprof:
- LEAP_PROFILE_IMAPCMD=1 LEAP_MAIL_MANHOLE=1 kernprof.py -l src/leap/bitmask/app.py --offline --debug
+ LEAP_PROFILE_IMAPCMD=1 LEAP_MAIL_MANHOLE=1 kernprof.py -l src/leap/bitmask/app.py --debug
+
+do_lineprof_offline:
+ LEAP_PROFILE_IMAPCMD=1 LEAP_MAIL_MANHOLE=1 kernprof.py -l src/leap/bitmask/app.py --offline --debug -N
view_lineprof:
@python -m line_profiler app.py.lprof | $(EDITOR) -
+resource_graph:
+ #./pkg/scripts/monitor_resource.zsh `ps aux | grep app.py | head -1 | awk '{print $$2}'` $(RESOURCE_TIME)
+ ./pkg/scripts/monitor_resource.zsh `pgrep bitmask` $(RESOURCE_TIME)
+ display bitmask-resources.png
+
clean :
$(RM) $(COMPILED_UI) $(COMPILED_RESOURCES) $(COMPILED_UI:.py=.pyc) $(COMPILED_RESOURCES:.py=.pyc)
diff --git a/changes/bug-5048_version-checks-in-wizard b/changes/bug-5048_version-checks-in-wizard
new file mode 100644
index 00000000..a5593e6c
--- /dev/null
+++ b/changes/bug-5048_version-checks-in-wizard
@@ -0,0 +1 @@
+- Use version checks in the wizard when the user choose to use an existing provider. Closes #5048.
diff --git a/changes/feature_nice-process b/changes/feature_nice-process
new file mode 100644
index 00000000..3de26e75
--- /dev/null
+++ b/changes/feature_nice-process
@@ -0,0 +1 @@
+- Add ability to nice application via environment variable.
diff --git a/pkg/scripts/monitor_resource.zsh b/pkg/scripts/monitor_resource.zsh
new file mode 100755
index 00000000..ac468e34
--- /dev/null
+++ b/pkg/scripts/monitor_resource.zsh
@@ -0,0 +1,26 @@
+#!/bin/zsh
+if (( ! $# )); then
+ echo "Usage: $0:t <PID> <minutes to monitor>" >&2
+ return 1;
+fi
+
+OUT="$1-usage.data"
+GRAPH="bitmask-resources.png"
+MAX=150
+let "ticks=$2*60/3"
+echo "cpu mem" >> $OUT
+for i in {1..$ticks}; do;
+ cpu=$(ps -p $1 -o pcpu | grep -v %)
+ mem=$(ps wuh -p $1 | awk '{print $4}')
+ echo "$cpu $mem" >> $OUT;
+ sleep 3;
+ echo $i / $ticks;
+done;
+
+gnuplot -e "set term dumb; \
+set key outside; set yrange [0:$MAX]; \
+plot for [col=1:2] '$OUT' using 0:col title columnheader s c"
+
+gnuplot -e "set term png; set output '$GRAPH'; \
+set key outside; set yrange [0:$MAX]; \
+plot for [col=1:2] '$OUT' using 0:col with lines title columnheader"
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py
index a1f3a69f..124671b3 100644
--- a/src/leap/bitmask/app.py
+++ b/src/leap/bitmask/app.py
@@ -233,6 +233,11 @@ def main():
# We don't even have logger configured in here
print "Could not ensure server: %r" % (e,)
+ PLAY_NICE = os.environ.get("LEAP_NICE")
+ if PLAY_NICE and PLAY_NICE.isdigit():
+ nice = os.nice(int(PLAY_NICE))
+ logger.info("Setting NICE: %s" % nice)
+
# And then we import all the other stuff
# I think it's safe to import at the top by now -- kali
from leap.bitmask.gui import locale_rc
diff --git a/src/leap/bitmask/gui/ui/wizard.ui b/src/leap/bitmask/gui/ui/wizard.ui
index d9b8499e..6c592522 100644
--- a/src/leap/bitmask/gui/ui/wizard.ui
+++ b/src/leap/bitmask/gui/ui/wizard.ui
@@ -269,20 +269,7 @@
<string>Configure or select a provider</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
- <item row="5" column="1">
- <widget class="QLineEdit" name="lnProvider"/>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>https://</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
+ <item row="1" column="0">
<widget class="QRadioButton" name="rbNewProvider">
<property name="text">
<string>Configure new provider:</string>
@@ -292,14 +279,27 @@
</property>
</widget>
</item>
- <item row="5" column="2">
- <widget class="QPushButton" name="btnCheck">
+ <item row="0" column="2">
+ <widget class="QComboBox" name="cbProviders">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="label">
<property name="text">
- <string>Check</string>
+ <string>https://</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="2" column="0">
+ <item row="1" column="2">
+ <widget class="QLineEdit" name="lnProvider"/>
+ </item>
+ <item row="0" column="0">
<widget class="QRadioButton" name="rbExistingProvider">
<property name="text">
<string>Use existing one:</string>
@@ -309,7 +309,7 @@
</property>
</widget>
</item>
- <item row="3" column="0">
+ <item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>https://</string>
@@ -319,12 +319,29 @@
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="QComboBox" name="cbProviders">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
+ <item row="2" column="2">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnCheck">
+ <property name="text">
+ <string>Check</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
@@ -859,8 +876,8 @@
<y>174</y>
</hint>
<hint type="destinationlabel">
- <x>454</x>
- <y>254</y>
+ <x>450</x>
+ <y>266</y>
</hint>
</hints>
</connection>
@@ -884,7 +901,7 @@
<sender>rbExistingProvider</sender>
<signal>toggled(bool)</signal>
<receiver>btnCheck</receiver>
- <slot>setDisabled(bool)</slot>
+ <slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>169</x>
diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py
index e1bed6b8..024b23bc 100644
--- a/src/leap/bitmask/gui/wizard.py
+++ b/src/leap/bitmask/gui/wizard.py
@@ -223,7 +223,7 @@ class Wizard(QtGui.QWizard):
depending on the lnProvider content.
"""
enabled = len(self.ui.lnProvider.text()) != 0
- enabled = enabled and self.ui.rbNewProvider.isChecked()
+ enabled = enabled or self.ui.rbExistingProvider.isChecked()
self.ui.btnCheck.setEnabled(enabled)
if reset:
@@ -367,8 +367,10 @@ class Wizard(QtGui.QWizard):
Starts the checks for a given provider
"""
- if len(self.ui.lnProvider.text()) == 0:
- return
+ if self.ui.rbNewProvider.isChecked():
+ self._domain = self.ui.lnProvider.text()
+ else:
+ self._domain = self.ui.cbProviders.currentText()
self._provider_checks_ok = False
@@ -380,7 +382,6 @@ class Wizard(QtGui.QWizard):
self.ui.btnCheck.setEnabled(False)
self.ui.lnProvider.setEnabled(False)
self.button(QtGui.QWizard.BackButton).clearFocus()
- self._domain = self.ui.lnProvider.text()
self.ui.lblNameResolution.setPixmap(self.QUESTION_ICON)
self._provider_select_defer = self._backend.\
@@ -401,8 +402,6 @@ class Wizard(QtGui.QWizard):
if skip:
self._reset_provider_check()
- self.page(self.SELECT_PROVIDER_PAGE).set_completed(skip)
- self.button(QtGui.QWizard.NextButton).setEnabled(skip)
self._use_existing_provider = skip
def _complete_task(self, data, label, complete=False, complete_page=-1):