Commit a9c57a95 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

geometry: Profile: Start to adapt profile window.

Showing with 131 additions and 226 deletions
+131 -226
...@@ -6,7 +6,7 @@ class Profile(object): ...@@ -6,7 +6,7 @@ class Profile(object):
def __init__(self, num: int = 0, def __init__(self, num: int = 0,
kp:float = 0.0, name:str = "", kp:float = 0.0, name:str = "",
code1: int = 0, code2: int = 0, code1: int = 0, code2: int = 0,
_type:str = ""): _type:str = "", reach = None):
super(Profile, self).__init__() super(Profile, self).__init__()
self._num = int(num) self._num = int(num)
...@@ -14,11 +14,16 @@ class Profile(object): ...@@ -14,11 +14,16 @@ class Profile(object):
self._code2 = int(code2) self._code2 = int(code2)
self._kp = float(kp) self._kp = float(kp)
self._name = str(name) self._name = str(name)
self._reach = reach
self._points: List[Point] = [] self._points: List[Point] = []
self._profile_type = _type self._profile_type = _type
@property
def reach(self):
return self._reach
@property @property
def num(self): def num(self):
""" """
......
...@@ -12,7 +12,8 @@ class ProfileXYZ(Profile): ...@@ -12,7 +12,8 @@ class ProfileXYZ(Profile):
def __init__(self, num: int = 0, def __init__(self, num: int = 0,
code1: int = 0, code2: int = 0, code1: int = 0, code2: int = 0,
nb_point: int = 0, nb_point: int = 0,
kp: float = 0., name: str = ""): kp: float = 0., name: str = "",
reach = None):
"""ProfileXYZ constructor """ProfileXYZ constructor
Args: Args:
...@@ -31,6 +32,7 @@ class ProfileXYZ(Profile): ...@@ -31,6 +32,7 @@ class ProfileXYZ(Profile):
kp = kp, kp = kp,
code1 = code1, code2 = code2, code1 = code1, code2 = code2,
_type = "XYZ", _type = "XYZ",
reach = reach,
) )
def __repr__(self): def __repr__(self):
......
...@@ -81,7 +81,7 @@ class Reach: ...@@ -81,7 +81,7 @@ class Reach:
Returns: Returns:
Nothing. Nothing.
""" """
profile = ProfileXYZ() profile = ProfileXYZ(reach=self)
self._profiles.insert(index, profile) self._profiles.insert(index, profile)
self._update_profile_numbers() self._update_profile_numbers()
...@@ -306,7 +306,7 @@ class Reach: ...@@ -306,7 +306,7 @@ class Reach:
if list_profile and list_header: if list_profile and list_header:
for ind, profile in enumerate(list_profile): for ind, profile in enumerate(list_profile):
prof = ProfileXYZ(*list_header[ind]) prof = ProfileXYZ(*list_header[ind], reach=self)
prof.import_points(profile) prof.import_points(profile)
self._profiles.append(prof) self._profiles.append(prof)
self._update_profile_numbers() self._update_profile_numbers()
......
...@@ -26,10 +26,10 @@ from View.Geometry.PlotXY import PlotXY ...@@ -26,10 +26,10 @@ from View.Geometry.PlotXY import PlotXY
from View.Geometry.PlotKPC import PlotKPC from View.Geometry.PlotKPC import PlotKPC
from View.Geometry.PlotAC import PlotAC from View.Geometry.PlotAC import PlotAC
from View.ASubWindow import WindowToolKit
from View.Geometry.mainwindow_ui_reach import Ui_MainWindow from View.Geometry.mainwindow_ui_reach import Ui_MainWindow
from View.Geometry import qtableview_reach from View.Geometry import qtableview_reach
from View.Geometry import window_profileXYZ from View.Geometry.Profile.ProfileWindow import ProfileWindow
from View.ASubWindow import WindowToolKit
_translate = QCoreApplication.translate _translate = QCoreApplication.translate
...@@ -49,7 +49,7 @@ class GeometryWindow(QMainWindow, WindowToolKit): ...@@ -49,7 +49,7 @@ class GeometryWindow(QMainWindow, WindowToolKit):
self.tableView_header = self.ui.tableView_header self.tableView_header = self.ui.tableView_header
self._tablemodel = None self._tablemodel = None
self._profile_window = []
self._clipboard = None self._clipboard = None
self.setup_window() self.setup_window()
...@@ -156,76 +156,19 @@ class GeometryWindow(QMainWindow, WindowToolKit): ...@@ -156,76 +156,19 @@ class GeometryWindow(QMainWindow, WindowToolKit):
print('OK clicked') print('OK clicked')
def edit_profile(self): def edit_profile(self):
list_selected_row = list(
set([index.row() for index in self.tableView.selectedIndexes()])
)
self.tableView.model().blockSignals(True) self.tableView.model().blockSignals(True)
if len(list_selected_row) > 5: for index in self.tableView.selectedIndexes():
self.messagebox_profile_editing() profile = self._reach.profile(index.row())
for selected_row in list_selected_row[:5]: self._profile_window.append(
selected_row = int(selected_row) ProfileWindow(
profile_identifier = self._reach.get_profile_selected_identifier(selected_row) profile = profile,
kp = self._reach.profile(selected_row).kp parent = self,
profile_name = self._reach.get_profile_name(selected_row)
if len(self.list_second_window) == 0:
self.second_window = window_profileXYZ.View(
selected_row + 1,
self._reach.get_profile_via_identifier(profile_identifier),
kp=kp, profile_name="", parent=self
)
self.second_window.window_title(
kp=kp,
profile_name=profile_name,
profile_selected_num=selected_row
) )
self.second_window.setWindowFlags(Qt.Window | Qt.WindowStaysOnTopHint) )
self.list_second_window.append(self.second_window)
self.second_window.show()
self.list_row.append(profile_identifier)
else:
if profile_identifier in self.list_row:
self.list_second_window[self.list_row.index(profile_identifier)]\
.window_title(
kp=kp, profile_name=profile_name,
profile_selected_num=selected_row
)
self.list_second_window[
self.list_row.index(profile_identifier)
].setWindowFlags(Qt.Window | Qt.WindowStaysOnTopHint)
self.list_second_window[
self.list_row.index(profile_identifier)
].show()
else:
second_window1 = window_profileXYZ.View(
selected_row + 1,
self._reach.get_profile_via_identifier(profile_identifier),
kp=kp, profile_name="", parent=self
)
second_window1.window_title(
kp=kp, profile_name=profile_name,
profile_selected_num=selected_row
)
second_window1.setWindowFlags(Qt.Window | Qt.WindowStaysOnTopHint)
second_window1.show()
self.list_row.append(profile_identifier)
self.list_second_window.append(second_window1)
widgetList = QApplication.topLevelWidgets()
numWindows = len(widgetList)
self.tableView.model().blockSignals(False)
def wind_profile_changed(self): self.tableView.model().blockSignals(False)
self.second_window\
.datachanged_signal[bool]\
.connect(self.changed_profile_slot)
pyqtSlot(bool) pyqtSlot(bool)
......
...@@ -199,18 +199,6 @@ class Ui_MainWindow(object): ...@@ -199,18 +199,6 @@ class Ui_MainWindow(object):
self.verticalLayout_left.addLayout(self.horizontalLayout) self.verticalLayout_left.addLayout(self.horizontalLayout)
self.tableView = QTableView(self.widget) self.tableView = QTableView(self.widget)
self.tableView.setStyleSheet(
" QTableView { border: 1px solid black;\n"
" gridline-color: blue;\n"
" border-radius: 2px;\n"
" border-style: solid;\n"
" background-color: #EEF6FC; \n"
" selection-background-color: #218ede;\n"
" font-size: 11.5px;\n"
" font-family: Helvetica\n"
"\n"
" }"
)
self.tableView.setObjectName("tableView") self.tableView.setObjectName("tableView")
self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows) self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.tableView.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) self.tableView.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
...@@ -230,41 +218,18 @@ class Ui_MainWindow(object): ...@@ -230,41 +218,18 @@ class Ui_MainWindow(object):
self.label_graphic_help = QtWidgets.QLabel(self.widget1) self.label_graphic_help = QtWidgets.QLabel(self.widget1)
self.label_graphic_help.setMaximumSize(QtCore.QSize(16777215, 25)) self.label_graphic_help.setMaximumSize(QtCore.QSize(16777215, 25))
self.label_graphic_help.setBaseSize(QtCore.QSize(0, 30)) self.label_graphic_help.setBaseSize(QtCore.QSize(0, 30))
self.label_graphic_help.setStyleSheet(
"QLabel { border: 1px solid blue;\n"
" gridline-color: blue;\n"
" border-radius: 3px;\n"
" border-style: solid;\n"
" background-color: #EEF6FC; \n"
" selection-background-color: black;\n"
" font-size: 11px;\n"
" font-family: Helvetica\n"
"}"
)
self.label_graphic_help.setObjectName("label_graphic_help") self.label_graphic_help.setObjectName("label_graphic_help")
self.verticalLayout_right.addWidget(self.label_graphic_help) self.verticalLayout_right.addWidget(self.label_graphic_help)
self.my_canvas = MplCanvas.MplCanvas(width=5, height=4, dpi=100) self.canvas = MplCanvas.MplCanvas(width=5, height=4, dpi=100)
self.my_canvas.setObjectName("my_canvas") self.canvas.setObjectName("canvas")
self.my_toolbar = navigation_toolbar_2qt.PamHyrNavigationToolbar2QT( self.my_toolbar = navigation_toolbar_2qt.PamHyrNavigationToolbar2QT(
self.my_canvas, self.widget1 self.canvas, self.widget1
)
self.my_toolbar.setStyleSheet(
"QToolBar{ border: 1px solid darkGray;\n"
" gridline-color: blue;\n"
" border-radius: 4px;\n"
" border-style: solid;\n"
" background-color: #EEF6FC; \n"
" selection-background-color: #218ede;\n"
" font-size: 12px;\n"
" font-family: Helvetica\n"
"\n"
" }"
) )
self.verticalLayout_right.addWidget(self.my_toolbar) self.verticalLayout_right.addWidget(self.my_toolbar)
self.verticalLayout_right.addWidget(self.my_canvas) self.verticalLayout_right.addWidget(self.canvas)
self.horizontalLayout_2.addWidget(self.splitter) self.horizontalLayout_2.addWidget(self.splitter)
MainWindowProfile.setCentralWidget(self.centralwidget) MainWindowProfile.setCentralWidget(self.centralwidget)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment