Skip to content

Commit bbdee8c

Browse files
committed
Fix Edit buttons behaviour in Windows
* Removed QScrollArea Frames * Refactor in MLCAboutDialog
1 parent a20fac0 commit bbdee8c

File tree

8 files changed

+105
-60
lines changed

8 files changed

+105
-60
lines changed

MLC/GUI/Autogenerated/autogenerated.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ def setupUi(self, BoardConfigurationWindow):
5656
self.verticalLayout.setSpacing(1)
5757
self.verticalLayout.setObjectName("verticalLayout")
5858
self.scrollArea = QtWidgets.QScrollArea(self.centralWidget)
59+
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
5960
self.scrollArea.setWidgetResizable(True)
6061
self.scrollArea.setObjectName("scrollArea")
6162
self.scrollAreaWidgetContents = QtWidgets.QWidget()
62-
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 1004, 652))
63+
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 1006, 654))
6364
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
6465
self.gridLayout_2 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
6566
self.gridLayout_2.setContentsMargins(11, 11, 11, 11)
@@ -602,7 +603,6 @@ def setupUi(self, BoardConfigurationWindow):
602603
self.gridLayout_2.addWidget(self.groupBox1, 0, 0, 1, 2)
603604
self.groupBox.raise_()
604605
self.groupBox.raise_()
605-
self.groupBox.raise_()
606606
self.benchTests.raise_()
607607
self.closeButton.raise_()
608608
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
@@ -1063,24 +1063,37 @@ def setupUi(self, MLCAboutDialog):
10631063
MLCAboutDialog.setSizeGripEnabled(False)
10641064
self.gridLayout = QtWidgets.QGridLayout(MLCAboutDialog)
10651065
self.gridLayout.setObjectName("gridLayout")
1066-
self.mlcimage = QtWidgets.QWidget(MLCAboutDialog)
1067-
self.mlcimage.setStyleSheet("image: url(:/boards/images/uno.jpg);")
1066+
self.scrollArea = QtWidgets.QScrollArea(MLCAboutDialog)
1067+
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
1068+
self.scrollArea.setWidgetResizable(True)
1069+
self.scrollArea.setObjectName("scrollArea")
1070+
self.scrollAreaWidgetContents = QtWidgets.QWidget()
1071+
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 385, 446))
1072+
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
1073+
self.verticalLayout = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
1074+
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
1075+
self.verticalLayout.setObjectName("verticalLayout")
1076+
self.mlcimage = QtWidgets.QLabel(self.scrollAreaWidgetContents)
1077+
self.mlcimage.setText("")
1078+
self.mlcimage.setAlignment(QtCore.Qt.AlignCenter)
10681079
self.mlcimage.setObjectName("mlcimage")
1069-
self.gridLayout.addWidget(self.mlcimage, 0, 0, 1, 1)
1070-
self.buttonBox = QtWidgets.QDialogButtonBox(MLCAboutDialog)
1071-
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
1072-
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
1073-
self.buttonBox.setCenterButtons(True)
1074-
self.buttonBox.setObjectName("buttonBox")
1075-
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)
1076-
self.labelabout = QtWidgets.QLabel(MLCAboutDialog)
1080+
self.verticalLayout.addWidget(self.mlcimage)
1081+
self.labelabout = QtWidgets.QLabel(self.scrollAreaWidgetContents)
10771082
self.labelabout.setText("")
10781083
self.labelabout.setTextFormat(QtCore.Qt.RichText)
10791084
self.labelabout.setWordWrap(True)
10801085
self.labelabout.setOpenExternalLinks(True)
10811086
self.labelabout.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
10821087
self.labelabout.setObjectName("labelabout")
1083-
self.gridLayout.addWidget(self.labelabout, 1, 0, 1, 1)
1088+
self.verticalLayout.addWidget(self.labelabout)
1089+
self.buttonBox = QtWidgets.QDialogButtonBox(self.scrollAreaWidgetContents)
1090+
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
1091+
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
1092+
self.buttonBox.setCenterButtons(True)
1093+
self.buttonBox.setObjectName("buttonBox")
1094+
self.verticalLayout.addWidget(self.buttonBox)
1095+
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
1096+
self.gridLayout.addWidget(self.scrollArea, 0, 0, 1, 1)
10841097

10851098
self.retranslateUi(MLCAboutDialog)
10861099
self.buttonBox.accepted.connect(MLCAboutDialog.accept)
@@ -1344,10 +1357,11 @@ def setupUi(self, ExperimentWindow):
13441357
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralWidget)
13451358
self.horizontalLayout.setObjectName("horizontalLayout")
13461359
self.scrollArea = QtWidgets.QScrollArea(self.centralWidget)
1360+
self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)
13471361
self.scrollArea.setWidgetResizable(True)
13481362
self.scrollArea.setObjectName("scrollArea")
13491363
self.scrollAreaWidgetContents = QtWidgets.QWidget()
1350-
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 931, 814))
1364+
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 933, 814))
13511365
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
13521366
self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self.scrollAreaWidgetContents)
13531367
self.horizontalLayout_6.setContentsMargins(0, 0, 0, 0)

MLC/GUI/Autogenerated/mlc_qtcreator/about.ui

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,67 @@
1818
</property>
1919
<layout class="QGridLayout" name="gridLayout">
2020
<item row="0" column="0">
21-
<widget class="QWidget" name="mlcimage" native="true">
22-
<property name="styleSheet">
23-
<string notr="true">image: url(:/boards/images/uno.jpg);</string>
21+
<widget class="QScrollArea" name="scrollArea">
22+
<property name="frameShape">
23+
<enum>QFrame::NoFrame</enum>
2424
</property>
25-
</widget>
26-
</item>
27-
<item row="2" column="0">
28-
<widget class="QDialogButtonBox" name="buttonBox">
29-
<property name="orientation">
30-
<enum>Qt::Horizontal</enum>
31-
</property>
32-
<property name="standardButtons">
33-
<set>QDialogButtonBox::Ok</set>
34-
</property>
35-
<property name="centerButtons">
25+
<property name="widgetResizable">
3626
<bool>true</bool>
3727
</property>
38-
</widget>
39-
</item>
40-
<item row="1" column="0">
41-
<widget class="QLabel" name="labelabout">
42-
<property name="text">
43-
<string/>
44-
</property>
45-
<property name="textFormat">
46-
<enum>Qt::RichText</enum>
47-
</property>
48-
<property name="wordWrap">
49-
<bool>true</bool>
50-
</property>
51-
<property name="openExternalLinks">
52-
<bool>true</bool>
53-
</property>
54-
<property name="textInteractionFlags">
55-
<set>Qt::TextBrowserInteraction</set>
56-
</property>
28+
<widget class="QWidget" name="scrollAreaWidgetContents">
29+
<property name="geometry">
30+
<rect>
31+
<x>0</x>
32+
<y>0</y>
33+
<width>385</width>
34+
<height>446</height>
35+
</rect>
36+
</property>
37+
<layout class="QVBoxLayout" name="verticalLayout">
38+
<item>
39+
<widget class="QLabel" name="mlcimage">
40+
<property name="text">
41+
<string/>
42+
</property>
43+
<property name="alignment">
44+
<set>Qt::AlignCenter</set>
45+
</property>
46+
</widget>
47+
</item>
48+
<item>
49+
<widget class="QLabel" name="labelabout">
50+
<property name="text">
51+
<string/>
52+
</property>
53+
<property name="textFormat">
54+
<enum>Qt::RichText</enum>
55+
</property>
56+
<property name="wordWrap">
57+
<bool>true</bool>
58+
</property>
59+
<property name="openExternalLinks">
60+
<bool>true</bool>
61+
</property>
62+
<property name="textInteractionFlags">
63+
<set>Qt::TextBrowserInteraction</set>
64+
</property>
65+
</widget>
66+
</item>
67+
<item>
68+
<widget class="QDialogButtonBox" name="buttonBox">
69+
<property name="orientation">
70+
<enum>Qt::Horizontal</enum>
71+
</property>
72+
<property name="standardButtons">
73+
<set>QDialogButtonBox::Ok</set>
74+
</property>
75+
<property name="centerButtons">
76+
<bool>true</bool>
77+
</property>
78+
</widget>
79+
</item>
80+
</layout>
81+
</widget>
5782
</widget>
5883
</item>
5984
</layout>

MLC/GUI/Autogenerated/mlc_qtcreator/board_config_design.ui

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
</property>
2727
<item>
2828
<widget class="QScrollArea" name="scrollArea">
29+
<property name="frameShape">
30+
<enum>QFrame::NoFrame</enum>
31+
</property>
2932
<property name="widgetResizable">
3033
<bool>true</bool>
3134
</property>
@@ -34,8 +37,8 @@
3437
<rect>
3538
<x>0</x>
3639
<y>0</y>
37-
<width>1004</width>
38-
<height>652</height>
40+
<width>1006</width>
41+
<height>654</height>
3942
</rect>
4043
</property>
4144
<layout class="QGridLayout" name="gridLayout_2">
@@ -1289,7 +1292,6 @@
12891292
</layout>
12901293
<zorder>groupBox</zorder>
12911294
<zorder>groupBox</zorder>
1292-
<zorder>groupBox</zorder>
12931295
<zorder>benchTests</zorder>
12941296
<zorder>closeButton</zorder>
12951297
</widget>

MLC/GUI/Autogenerated/mlc_qtcreator/experiment.ui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<layout class="QHBoxLayout" name="horizontalLayout">
2121
<item>
2222
<widget class="QScrollArea" name="scrollArea">
23+
<property name="frameShape">
24+
<enum>QFrame::NoFrame</enum>
25+
</property>
2326
<property name="widgetResizable">
2427
<bool>true</bool>
2528
</property>
@@ -28,7 +31,7 @@
2831
<rect>
2932
<x>0</x>
3033
<y>0</y>
31-
<width>931</width>
34+
<width>933</width>
3235
<height>814</height>
3336
</rect>
3437
</property>

MLC/GUI/Experiment/ExperimentWindow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def on_ev_edit_button_clicked(self):
386386
logger.debug('[EXPERIMENT {0}] [EV_EDIT_BUTTON_CLICKED] - Proceed to open file: {0}'
387387
.format(ev_path))
388388
# Check if file exists
389-
QDesktopServices.openUrl(QUrl(ev_path))
389+
QDesktopServices.openUrl(QUrl.fromLocalFile(ev_path))
390390
else:
391391
QMessageBox.critical(self, "Edit Evaluation Script",
392392
"Evaluation file doesn't exists. Check that file {0} exists"
@@ -413,7 +413,7 @@ def on_preev_edit_button_clicked(self):
413413
logger.debug('[EXPERIMENT {0}] [PREEV_EDIT_BUTTON_CLICKED] - Proceed to open file: {0}'
414414
.format(preev_path))
415415
# Check if file exists
416-
QDesktopServices.openUrl(QUrl(preev_path))
416+
QDesktopServices.openUrl(QUrl.fromLocalFile(preev_path))
417417
else:
418418
QMessageBox.critical(self, "Edit Preevaluation Script",
419419
"Preevaluation file doesn't exists. Check that file {0} exists"
@@ -475,7 +475,7 @@ def on_edit_config_button_clicked(self):
475475
logger.debug('[EXPERIMENT {0}] [EDIT_CONFIG_BUTTON] - '
476476
'Executing on_edit_config_button_clicked function'
477477
.format(self._experiment_name))
478-
QDesktopServices.openUrl(QUrl(self._experiment_conf_path))
478+
QDesktopServices.openUrl(QUrl.fromLocalFile(self._experiment_conf_path))
479479

480480
def on_first_add_indiv_button_clicked(self):
481481
self._first_indivs_manager.add_individual()

MLC/GUI/Experiment/QtCharts/GenealogyChart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _add_individuals(self):
125125
parents = generations[gen].get_parents()[indiv_id - 1]
126126
for parent_index in range(len(parents)):
127127
new_indivs_to_process.append(parents[parent_index])
128-
self.add_line_curve(line_width=.7,
128+
self.add_line_curve(line_width=2,
129129
color=GenealogyChart.INDIV_COLORS[gen_method - 1])
130130
self.append_point(self._next_curve, gen + 1, indiv_id)
131131
self.append_point(self._next_curve, gen, parents[parent_index])

MLC/GUI/MLCAboutDialog.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
import os
2323
from PyQt5.QtWidgets import QDialog
24+
from PyQt5.QtGui import QPixmap
25+
from PyQt5.QtCore import Qt
2426
from MLC.GUI.Autogenerated.autogenerated import Ui_MLCAboutDialog
2527

2628

@@ -49,15 +51,14 @@ class MLCAboutDialog(QDialog):
4951
<br>
5052
""" % "3.0"
5153

52-
def __init__(self, board_path, parent=None):
54+
def __init__(self, parent=None):
5355
super(MLCAboutDialog, self).__init__(parent)
5456
icon_path = os.path.join(*[os.path.dirname(os.path.abspath(__file__)),
5557
"images",
5658
"mlc_icon.png"])
5759

5860
self.ui = Ui_MLCAboutDialog()
5961
self.ui.setupUi(self)
60-
self.ui.mlcimage.setStyleSheet("image: url({0});".format(icon_path))
62+
pixmap = QPixmap(icon_path)
63+
self.ui.mlcimage.setPixmap(pixmap.scaled(300, 300, Qt.KeepAspectRatio))
6164
self.ui.labelabout.setText(self.MLC_ABOUT)
62-
self.resize(600, 500)
63-
self.setFixedSize(600, 500)

MLC/GUI/mlc_gui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def edit_gui_config(self):
508508
dialog.exec_()
509509

510510
def menu_about(self):
511-
dialog = MLCAboutDialog(self)
511+
dialog = MLCAboutDialog(parent=self)
512512
dialog.exec_()
513513

514514
def _create_gui_config_from_scratch(self, config_filepath, workspace_dir):

0 commit comments

Comments
 (0)