Skip to content

Commit 13e2415

Browse files
authored
Improve module widget layout (#13)
Version information section was squashed vertically and some other minor layout and label issues were fixed.
1 parent 0a835ef commit 13e2415

File tree

2 files changed

+58
-49
lines changed

2 files changed

+58
-49
lines changed

PyTorchUtils/PyTorchUtils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ def installTorch(self, askConfirmation=False, forceComputationBackend=None, torc
213213
logging.info('Installation of PyTorch aborted by user')
214214
return None
215215

216+
logging.info(f"Install PyTorch using light-the-torch with arguments: {args}")
217+
216218
try:
217219
import light_the_torch._patch
218220
except:

PyTorchUtils/Resources/UI/PyTorchUtils.ui

Lines changed: 56 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>442</width>
10-
<height>449</height>
9+
<width>394</width>
10+
<height>378</height>
1111
</rect>
1212
</property>
1313
<layout class="QVBoxLayout" name="verticalLayout">
1414
<item>
1515
<widget class="QFrame" name="frame">
16-
<property name="minimumSize">
17-
<size>
18-
<width>0</width>
19-
<height>30</height>
20-
</size>
21-
</property>
2216
<property name="frameShape">
2317
<enum>QFrame::StyledPanel</enum>
2418
</property>
@@ -29,7 +23,7 @@
2923
<item row="0" column="0">
3024
<widget class="QLabel" name="label_7">
3125
<property name="text">
32-
<string>PyTorch:</string>
26+
<string>Torch:</string>
3327
</property>
3428
</widget>
3529
</item>
@@ -41,28 +35,28 @@
4135
</widget>
4236
</item>
4337
<item row="1" column="0">
44-
<widget class="QLabel" name="label_8">
38+
<widget class="QLabel" name="label_11">
4539
<property name="text">
46-
<string>NVIDIA driver:</string>
40+
<string>TorchVision:</string>
4741
</property>
4842
</widget>
4943
</item>
5044
<item row="1" column="1">
51-
<widget class="QLabel" name="nvidiaVersionInformation">
45+
<widget class="QLabel" name="torchvisionVersionInformation">
5246
<property name="text">
5347
<string/>
5448
</property>
5549
</widget>
5650
</item>
5751
<item row="2" column="0">
58-
<widget class="QLabel" name="label_11">
52+
<widget class="QLabel" name="label_8">
5953
<property name="text">
60-
<string>TorchVision:</string>
54+
<string>NVIDIA driver:</string>
6155
</property>
6256
</widget>
6357
</item>
6458
<item row="2" column="1">
65-
<widget class="QLabel" name="torchvisionVersionInformation">
59+
<widget class="QLabel" name="nvidiaVersionInformation">
6660
<property name="text">
6761
<string/>
6862
</property>
@@ -80,28 +74,45 @@
8074
<item row="0" column="0">
8175
<widget class="QLabel" name="label_9">
8276
<property name="text">
83-
<string>PyTorch version requirement:</string>
77+
<string>Torch version requirement:</string>
8478
</property>
8579
</widget>
8680
</item>
8781
<item row="0" column="1">
8882
<widget class="QLineEdit" name="torchVersionLineEdit">
8983
<property name="toolTip">
90-
<string>Optional version requirement for installing PyTorch. For example, to install PyTorch version 1.12 or later, set this to &quot;&gt;=1.12&quot;. The field has no effect if PyTorch is already installed.</string>
84+
<string>Optional version requirement for installing Torch. For example, to install TorchVision version to earlier than 2.0, set this to &quot;&lt;2.0&quot;. The field has no effect if PyTorch is already installed.</string>
9185
</property>
9286
<property name="placeholderText">
9387
<string>default</string>
9488
</property>
9589
</widget>
9690
</item>
97-
<item row="3" column="0">
91+
<item row="1" column="0">
92+
<widget class="QLabel" name="label_10">
93+
<property name="text">
94+
<string>TorchVision version requirement:</string>
95+
</property>
96+
</widget>
97+
</item>
98+
<item row="1" column="1">
99+
<widget class="QLineEdit" name="torchvisionVersionLineEdit">
100+
<property name="toolTip">
101+
<string>Optional version requirement for installing TorchVision. For example, to install TorchVision version 1.12 or later, set this to &quot;&gt;=1.12&quot;. The field has no effect if PyTorch is already installed.</string>
102+
</property>
103+
<property name="placeholderText">
104+
<string>default</string>
105+
</property>
106+
</widget>
107+
</item>
108+
<item row="2" column="0">
98109
<widget class="QLabel" name="label_6">
99110
<property name="text">
100111
<string>Computation backend:</string>
101112
</property>
102113
</widget>
103114
</item>
104-
<item row="3" column="1">
115+
<item row="2" column="1">
105116
<layout class="QHBoxLayout" name="horizontalLayout">
106117
<item>
107118
<widget class="QComboBox" name="backendComboBox">
@@ -141,43 +152,39 @@
141152
</item>
142153
</layout>
143154
</item>
144-
<item row="5" column="0" colspan="2">
155+
<item row="3" column="0" colspan="2">
145156
<widget class="QPushButton" name="installPushButton">
146-
<property name="text">
147-
<string>Install PyTorch</string>
148-
</property>
149-
</widget>
150-
</item>
151-
<item row="6" column="0" colspan="2">
152-
<widget class="QPushButton" name="uninstallPushButton">
153-
<property name="text">
154-
<string>Uninstall PyTorch</string>
155-
</property>
156-
</widget>
157-
</item>
158-
<item row="7" column="0" colspan="2">
159-
<widget class="QPushButton" name="restartPushButton">
160157
<property name="toolTip">
161-
<string>Restart Slicer. If PyTorch is in use, the application must be restarted before it can be uninstalled.</string>
158+
<string>Install Torch and TorchVision</string>
162159
</property>
163160
<property name="text">
164-
<string>Restart the application</string>
165-
</property>
166-
</widget>
167-
</item>
168-
<item row="2" column="0">
169-
<widget class="QLabel" name="label_10">
170-
<property name="text">
171-
<string>TorchVision version requirement</string>
161+
<string>Install PyTorch</string>
172162
</property>
173163
</widget>
174164
</item>
175-
<item row="2" column="1">
176-
<widget class="QLineEdit" name="torchvisionVersionLineEdit">
177-
<property name="placeholderText">
178-
<string>default</string>
179-
</property>
180-
</widget>
165+
<item row="4" column="0" colspan="2">
166+
<layout class="QHBoxLayout" name="horizontalLayout_3">
167+
<item>
168+
<widget class="QPushButton" name="uninstallPushButton">
169+
<property name="toolTip">
170+
<string>Uninstall Torch and TorchVision. Application restart may be required.</string>
171+
</property>
172+
<property name="text">
173+
<string>Uninstall PyTorch</string>
174+
</property>
175+
</widget>
176+
</item>
177+
<item>
178+
<widget class="QPushButton" name="restartPushButton">
179+
<property name="toolTip">
180+
<string>Restart Slicer. If Torch is in use, the application must be restarted before it can be uninstalled.</string>
181+
</property>
182+
<property name="text">
183+
<string>Restart the application</string>
184+
</property>
185+
</widget>
186+
</item>
187+
</layout>
181188
</item>
182189
</layout>
183190
</widget>

0 commit comments

Comments
 (0)