-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from medusabci/developers
Bug fixes
- Loading branch information
Showing
10 changed files
with
395 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# PYTHON MODULES | ||
import sys | ||
import json | ||
import importlib | ||
import multiprocessing as mp | ||
# EXTERNAL MODULES | ||
from PyQt5 import uic | ||
from PyQt5.QtWidgets import * | ||
from PyQt5.QtCore import * | ||
from PyQt5.QtGui import * | ||
# MEDUSA MODULES | ||
from gui import gui_utils as gu | ||
import constants, exceptions | ||
|
||
|
||
ui_plots_panel_widget = \ | ||
uic.loadUiType('gui/ui_files/studies_panel_widget.ui')[0] | ||
|
||
|
||
class StudiesPanelWidget(QWidget, ui_plots_panel_widget): | ||
|
||
def __init__(self, medusa_interface, theme_colors): | ||
super().__init__() | ||
self.setupUi(self) | ||
# Attributes | ||
self.medusa_interface = medusa_interface | ||
self.theme_colors = theme_colors | ||
self.studies_settings = None | ||
self.undocked = False | ||
# Set up tool bar | ||
self.set_up_tool_bar_studies() | ||
|
||
def handle_exception(self, ex): | ||
# Treat exception | ||
if not isinstance(ex, exceptions.MedusaException): | ||
ex = exceptions.MedusaException( | ||
ex, importance='unknown', | ||
scope='studies', | ||
origin='studies_panel/studies_panel/handle_exception') | ||
# Notify exception to gui main | ||
self.medusa_interface.error(ex) | ||
|
||
def set_undocked(self, undocked): | ||
self.undocked = undocked | ||
self.reset_tool_bar_studies_buttons() | ||
|
||
def reset_tool_bar_studies_buttons(self): | ||
try: | ||
# Creates QIcons for the app tool bar | ||
studies_config_icon = gu.get_icon("settings.svg", self.theme_colors) | ||
studies_undock_icon = gu.get_icon("open_in_new.svg", self.theme_colors) | ||
|
||
# Set icons in buttons | ||
self.toolButton_studies_config.setIcon(studies_config_icon) | ||
self.toolButton_studies_config.setToolTip('Studies settings') | ||
self.toolButton_studies_undock.setIcon(studies_undock_icon) | ||
self.toolButton_studies_undock.setToolTip('Undock') | ||
except Exception as e: | ||
self.handle_exception(e) | ||
|
||
def set_up_tool_bar_studies(self): | ||
"""This method creates the QAction buttons displayed in the toolbar | ||
""" | ||
try: | ||
# Creates QIcons for the app tool bar | ||
self.reset_tool_bar_studies_buttons() | ||
# Connect signals to functions | ||
self.toolButton_studies_config.clicked.connect(self.studies_config) | ||
except Exception as e: | ||
self.handle_exception(e) | ||
|
||
def studies_config(self): | ||
try: | ||
raise Exception('Not implemented') | ||
except Exception as e: | ||
self.handle_exception(e) | ||
|
||
|
||
class StudiesPanelWindow(QMainWindow): | ||
|
||
close_signal = pyqtSignal() | ||
|
||
def __init__(self, studies_panel_widget, theme_colors, | ||
width=400, height=650): | ||
super().__init__() | ||
# self.plots_panel_widget = plots_panel_widget | ||
self.theme_colors = theme_colors | ||
self.setCentralWidget(studies_panel_widget) | ||
gu.set_css_and_theme(self, self.theme_colors) | ||
# Resize plots window | ||
self.resize(width, height) | ||
self.show() | ||
|
||
def closeEvent(self, event): | ||
self.close_signal.emit() | ||
event.accept() | ||
|
||
def get_plots_panel_widget(self): | ||
return self.centralWidget() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Form</class> | ||
<widget class="QWidget" name="Form"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>300</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Form</string> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QHBoxLayout" name="log_toolbar"> | ||
<item> | ||
<widget class="QToolButton" name="toolButton_studies_config"> | ||
<property name="toolTip"> | ||
<string extracomment="Log settings"/> | ||
</property> | ||
<property name="text"> | ||
<string>...</string> | ||
</property> | ||
<property name="iconSize"> | ||
<size> | ||
<width>20</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<spacer name="horizontalSpacer_3"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>40</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item> | ||
<widget class="QToolButton" name="toolButton_studies_undock"> | ||
<property name="toolTip"> | ||
<string extracomment="Undock"/> | ||
</property> | ||
<property name="text"> | ||
<string>...</string> | ||
</property> | ||
<property name="iconSize"> | ||
<size> | ||
<width>20</width> | ||
<height>20</height> | ||
</size> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<widget class="QTreeView" name="treeView_studies"/> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |