Skip to content

Commit

Permalink
Merge UI crash fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo-iniguez-goya committed Feb 19, 2020
2 parents 7ca2044 + 8d88a4c commit 189cffb
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 18 deletions.
5 changes: 4 additions & 1 deletion ui/bin/opensnitch-ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ if __name__ == '__main__':
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
app = QtWidgets.QApplication(sys.argv)
if supported_qt_version(5,6,0):
app.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
try:
app.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
except Exception:
pass

service = UIService(app, on_exit)
server = grpc.server(futures.ThreadPoolExecutor(max_workers=4))
Expand Down
8 changes: 4 additions & 4 deletions ui/opensnitch/dialogs/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ def _render_connection(self, con):
except Exception:
pass

if dst_host == None:
if dst_host != None and len(dst_host.groups()) == 2:
self._add_dsthost_to_combo(dst_host.group(2))
else:
dst_host = con.dst_host
self._what_combo.addItem("%s" % con.dst_host, "simple_host")
self._add_dsthost_to_combo(con.dst_host)
else:
self._add_dsthost_to_combo(dst_host[2])

self._what_dstip_combo.addItem("to %s" % con.dst_ip, "dst_ip")

Expand Down Expand Up @@ -278,7 +278,7 @@ def _add_dsthost_to_combo(self, dst_host):

if nparts == 1:
self._what_combo.addItem("to *%s" % dst_host, "regex_host")
self._what_dstip.addItem("to *%s" % dst_host, "regex_host")
self._what_dstip_combo.addItem("to *%s" % dst_host, "regex_host")

def _get_duration(self, duration_idx):
if duration_idx == 0:
Expand Down
53 changes: 40 additions & 13 deletions ui/opensnitch/res/prompt.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>558</width>
<height>277</height>
<height>288</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -60,7 +60,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<y>70</y>
<width>541</width>
<height>20</height>
</rect>
Expand All @@ -73,9 +73,9 @@
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<y>90</y>
<width>541</width>
<height>35</height>
<height>41</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -85,7 +85,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Chromium Web Browser wants to connect to www.evilsocket.net on tcp port 443.</string>
<string>Chromium Web Browser wants to connect to www.evilsocket.net on tcp port 443. And maybe to www.goodsocket.net on port 344</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
Expand Down Expand Up @@ -120,7 +120,7 @@
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<y>130</y>
<width>541</width>
<height>110</height>
</rect>
Expand Down Expand Up @@ -361,6 +361,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumContentsLength">
<number>0</number>
</property>
</widget>
</item>
</layout>
Expand All @@ -371,11 +374,11 @@
<x>67</x>
<y>40</y>
<width>481</width>
<height>16</height>
<height>31</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -386,21 +389,33 @@
</font>
</property>
<property name="text">
<string>/op/google/chrome/bin/chrome --something abc --something else</string>
<string>/opt/google/chrome/bin/chrome --something abc --more-long def --for-word-wrapping test</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<y>250</y>
<width>541</width>
<height>31</height>
<height>34</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="actionCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Ignored">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>97</width>
Expand All @@ -419,7 +434,7 @@
</property>
<property name="icon">
<iconset theme="emblem-default">
<normaloff>../../../../../../../../../../../../../../.designer/backup</normaloff>../../../../../../../../../../../../../../.designer/backup</iconset>
<normaloff>../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../.designer/backup</normaloff>../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../.designer/backup</iconset>
</property>
</item>
<item>
Expand All @@ -428,7 +443,7 @@
</property>
<property name="icon">
<iconset theme="emblem-important">
<normaloff>../../../../../../../../../../../../../../.designer/backup</normaloff>../../../../../../../../../../../../../../.designer/backup</iconset>
<normaloff>../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../.designer/backup</normaloff>../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../.designer/backup</iconset>
</property>
</item>
</widget>
Expand Down Expand Up @@ -561,6 +576,18 @@
</item>
<item>
<widget class="QPushButton" name="checkAdvanced">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
Expand Down

0 comments on commit 189cffb

Please sign in to comment.