-
Notifications
You must be signed in to change notification settings - Fork 5
sliders in project view #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
90a4420
20228fc
f9f3add
5339569
7dac836
0578650
e28bb5b
4ff0e70
e4d26ec
a143191
d5da3d9
3777b79
e9e640e
d3597ee
4e5504e
bdf4c55
3dcb096
1d219f1
625610e
2f62783
87edc5b
4b93618
8938f38
28f900e
736e0b7
5253082
1633a0d
1391a4b
82abb27
2465ae8
2cafa03
d730b89
df8259e
6d12297
06d2d5c
bf28e3d
d4d795c
90f1f36
7727e56
4d03d05
a3bab04
21387f7
ba72197
c6325c2
5e993e8
7436406
55b3812
e95392b
d08054d
1ff90b7
7cd7465
e30d594
e004f23
dbb03d0
3813544
4ad1d5d
2dc3ce5
96a9fbd
ffbd6d6
799d24d
31578d9
d27a228
9583d78
2ee9fa2
e9a231c
eea2eba
67cf3f2
1d13a15
c1526a7
c195ac0
3ec35ce
b211310
bf522dd
432533d
5b2c1ab
d54b37a
755f0ef
d6f2a55
056f1b6
08ebb79
ac56a08
b44101c
2f3de6b
8e671d2
f89decc
d485dc6
99576b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |||||||||||||||||||||||||
| from rascal2.dialogs.settings_dialog import SettingsDialog | ||||||||||||||||||||||||||
| from rascal2.dialogs.startup_dialog import PROJECT_FILES, LoadDialog, LoadR1Dialog, NewProjectDialog, StartupDialog | ||||||||||||||||||||||||||
| from rascal2.settings import MDIGeometries, Settings, get_global_settings | ||||||||||||||||||||||||||
| from rascal2.widgets import ControlsWidget, PlotWidget, TerminalWidget | ||||||||||||||||||||||||||
| from rascal2.widgets import ControlsWidget, PlotWidget, SlidersViewWidget, TerminalWidget | ||||||||||||||||||||||||||
| from rascal2.widgets.project import ProjectWidget | ||||||||||||||||||||||||||
| from rascal2.widgets.startup import StartUpWidget | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -22,6 +22,11 @@ class MainWindowView(QtWidgets.QMainWindow): | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def __init__(self): | ||||||||||||||||||||||||||
| super().__init__() | ||||||||||||||||||||||||||
| # Public interface | ||||||||||||||||||||||||||
| self.disabled_elements = [] | ||||||||||||||||||||||||||
| self.show_sliders = False # no one displays sliders initially except got from configuration | ||||||||||||||||||||||||||
| # (not implemented yet) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| self.setWindowTitle(MAIN_WINDOW_TITLE) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| window_icon = QtGui.QIcon(path_for("logo.png")) | ||||||||||||||||||||||||||
|
|
@@ -38,14 +43,21 @@ def __init__(self): | |||||||||||||||||||||||||
| self.plot_widget = PlotWidget(self) | ||||||||||||||||||||||||||
| self.terminal_widget = TerminalWidget() | ||||||||||||||||||||||||||
| self.controls_widget = ControlsWidget(self) | ||||||||||||||||||||||||||
| self.sliders_view_widget = SlidersViewWidget(self) | ||||||||||||||||||||||||||
| self.project_widget = ProjectWidget(self) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| self.disabled_elements = [] | ||||||||||||||||||||||||||
| ## protected interface and public properties construction | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # define menu controlling switch between table and slider views | ||||||||||||||||||||||||||
| self._sliders_menu_control_text = { | ||||||||||||||||||||||||||
| "ShowSliders": "&Show Sliders", # if state is show sliders, click will show them | ||||||||||||||||||||||||||
| "HideSliders": "&Hide Sliders", | ||||||||||||||||||||||||||
| } # if state is show table, click will show sliders | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| self.create_actions() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| self.main_menu = self.menuBar() | ||||||||||||||||||||||||||
| self.add_submenus(self.main_menu) | ||||||||||||||||||||||||||
| main_menu = self.menuBar() | ||||||||||||||||||||||||||
| self.add_submenus(main_menu) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| self.create_toolbar() | ||||||||||||||||||||||||||
| self.create_status_bar() | ||||||||||||||||||||||||||
|
|
@@ -166,6 +178,20 @@ def create_actions(self): | |||||||||||||||||||||||||
| open_help_action.triggered.connect(self.open_docs) | ||||||||||||||||||||||||||
| self.open_help_action = open_help_action | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| # done this way expecting the value "show_sliders" being stored | ||||||||||||||||||||||||||
| # in configuration in a future + "show_sliders" is public for this reason | ||||||||||||||||||||||||||
| if self.show_sliders: | ||||||||||||||||||||||||||
| # if show_sliders state is True, action will be hide | ||||||||||||||||||||||||||
| show_or_hide_slider_action = QtGui.QAction(self._sliders_menu_control_text["HideSliders"], self) | ||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||
| # if display_sliders state is False, action will be show | ||||||||||||||||||||||||||
| show_or_hide_slider_action = QtGui.QAction(self._sliders_menu_control_text["ShowSliders"], self) | ||||||||||||||||||||||||||
| show_or_hide_slider_action.setStatusTip("Show or Hide Sliders") | ||||||||||||||||||||||||||
| show_or_hide_slider_action.triggered.connect(lambda: self.show_or_hide_sliders(None)) | ||||||||||||||||||||||||||
| self._show_or_hide_slider_action = show_or_hide_slider_action | ||||||||||||||||||||||||||
| self._show_or_hide_slider_action.setEnabled(False) | ||||||||||||||||||||||||||
| self.disabled_elements.append(self._show_or_hide_slider_action) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| open_about_action = QtGui.QAction("&About", self) | ||||||||||||||||||||||||||
| open_about_action.setStatusTip("Report RAT version&info") | ||||||||||||||||||||||||||
| open_about_action.triggered.connect(self.open_about_info) | ||||||||||||||||||||||||||
|
|
@@ -242,6 +268,8 @@ def add_submenus(self, main_menu: QtWidgets.QMenuBar): | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| tools_menu = main_menu.addMenu("&Tools") | ||||||||||||||||||||||||||
| tools_menu.setObjectName("&Tools") | ||||||||||||||||||||||||||
| tools_menu.addAction(self._show_or_hide_slider_action) | ||||||||||||||||||||||||||
| tools_menu.addSeparator() | ||||||||||||||||||||||||||
| tools_menu.addAction(self.clear_terminal_action) | ||||||||||||||||||||||||||
| tools_menu.addSeparator() | ||||||||||||||||||||||||||
| tools_menu.addAction(self.setup_matlab_action) | ||||||||||||||||||||||||||
|
|
@@ -251,6 +279,32 @@ def add_submenus(self, main_menu: QtWidgets.QMenuBar): | |||||||||||||||||||||||||
| help_menu.addAction(self.open_about_action) | ||||||||||||||||||||||||||
| help_menu.addAction(self.open_help_action) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def show_or_hide_sliders(self, do_show_sliders=None): | ||||||||||||||||||||||||||
| """Depending on current state, show or hide sliders for | ||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docstring is not in the correct format. Please see numpydoc format
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description there is pretty waigue. Hopefully clarified.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Numpydoc is used all over the repo, you can copy from many examples RasCAL-2/rascal2/ui/presenter.py Lines 113 to 124 in 65ec2ae
there are also example on the internet https://www.sphinx-doc.org/en/master/usage/extensions/example_numpy.html
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hopefully I have picked it up, but this is not exaclty what is there in different places. BTW, pycharm suggests sligly different format, e.g. |
||||||||||||||||||||||||||
| table properties within Project class view. | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Parameters: | ||||||||||||||||||||||||||
| ----------- | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| do_show_sliders: bool,default None | ||||||||||||||||||||||||||
| if provided, sets self.show_sliders logical variable into the requested state | ||||||||||||||||||||||||||
| (True/False), forcing sliders widget to appear/disappear. if None, applies not to current state. | ||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||
| if do_show_sliders is None: | ||||||||||||||||||||||||||
| self.show_sliders = not self.show_sliders | ||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||
| self.show_sliders = do_show_sliders | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if self.show_sliders: | ||||||||||||||||||||||||||
| self._show_or_hide_slider_action.setText(self._sliders_menu_control_text["HideSliders"]) | ||||||||||||||||||||||||||
| self.sliders_view_widget.show() | ||||||||||||||||||||||||||
| self.project_widget.setWindowTitle("Sliders View") | ||||||||||||||||||||||||||
| self.project_widget.stacked_widget.setCurrentIndex(2) | ||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||
| self._show_or_hide_slider_action.setText(self._sliders_menu_control_text["ShowSliders"]) | ||||||||||||||||||||||||||
| self.sliders_view_widget.hide() | ||||||||||||||||||||||||||
| self.project_widget.show_project_view() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def open_about_info(self): | ||||||||||||||||||||||||||
| """Opens about menu containing information about RASCAL gui""" | ||||||||||||||||||||||||||
| self.about_dialog.update_rascal_info(self) | ||||||||||||||||||||||||||
|
|
@@ -311,7 +365,9 @@ def setup_mdi(self): | |||||||||||||||||||||||||
| self.setCentralWidget(self.mdi) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def setup_mdi_widgets(self): | ||||||||||||||||||||||||||
| """Performs setup of MDI widgets that relies on the Project existing.""" | ||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||
| Performs initialization of MDI widgets that rely on the Project being defined. | ||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||
| self.controls_widget.setup_controls() | ||||||||||||||||||||||||||
| self.project_widget.show_project_view() | ||||||||||||||||||||||||||
| self.plot_widget.clear() | ||||||||||||||||||||||||||
|
|
@@ -333,7 +389,6 @@ def reset_mdi_layout(self): | |||||||||||||||||||||||||
| window.showMinimized() | ||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||
| window.showNormal() | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| window.setGeometry(x, y, width, height) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| def save_mdi_layout(self): | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does
do_show_slidersdefault toNonewhy not justFalse?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the widget supports triple logic. If you give true or false, it does what requested, but if none, inverts the current state.