[add] style settings option
This commit is contained in:
parent
d93a571a51
commit
f0e4ba5ab2
17
QtPyLoT.py
17
QtPyLoT.py
@ -554,9 +554,9 @@ class MainWindow(QMainWindow):
|
|||||||
self.pg = pg
|
self.pg = pg
|
||||||
|
|
||||||
# init style
|
# init style
|
||||||
self.set_style('dark')
|
settings = QSettings()
|
||||||
#self.set_style('bright')
|
style = settings.value('style')
|
||||||
#self.set_style('default')
|
self.set_style(style)
|
||||||
|
|
||||||
# add event combo box and ref/test buttons
|
# add event combo box and ref/test buttons
|
||||||
self.eventBox = self.createEventBox()
|
self.eventBox = self.createEventBox()
|
||||||
@ -698,11 +698,13 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
stylecolors['stylesheet'] = stylesheet
|
stylecolors['stylesheet'] = stylesheet
|
||||||
|
|
||||||
def set_style(self, stylename='default'):
|
def set_style(self, stylename=None):
|
||||||
|
if not stylename:
|
||||||
|
stylename = 'default'
|
||||||
if not stylename in self._styles:
|
if not stylename in self._styles:
|
||||||
qmb = QMessageBox.warning(self, 'Could not find style',
|
qmb = QMessageBox.warning(self, 'Could not find style',
|
||||||
'Could not find style with name {}. Using default.'.format(stylename))
|
'Could not find style with name {}. Using default.'.format(stylename))
|
||||||
self.set_style()
|
self.set_style('default')
|
||||||
return
|
return
|
||||||
|
|
||||||
style = self._styles[stylename]
|
style = self._styles[stylename]
|
||||||
@ -740,6 +742,10 @@ class MainWindow(QMainWindow):
|
|||||||
pg.setConfigOption('background', bg_color)
|
pg.setConfigOption('background', bg_color)
|
||||||
pg.setConfigOption('foreground', line_color)
|
pg.setConfigOption('foreground', line_color)
|
||||||
|
|
||||||
|
settings = QSettings()
|
||||||
|
settings.setValue('style', stylename)
|
||||||
|
settings.sync()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def metadata(self):
|
def metadata(self):
|
||||||
return self._metadata
|
return self._metadata
|
||||||
@ -3182,6 +3188,7 @@ def create_window():
|
|||||||
# window.show()
|
# window.show()
|
||||||
return app, app_created
|
return app, app_created
|
||||||
|
|
||||||
|
|
||||||
def main(args=None):
|
def main(args=None):
|
||||||
project_filename = None
|
project_filename = None
|
||||||
#args.project_filename = 'C:/Shared/AlpArray/alparray_data/project_alparray_test.plp'
|
#args.project_filename = 'C:/Shared/AlpArray/alparray_data/project_alparray_test.plp'
|
||||||
|
@ -3422,6 +3422,7 @@ class SubmitLocal(QWidget):
|
|||||||
class PropertiesDlg(QDialog):
|
class PropertiesDlg(QDialog):
|
||||||
def __init__(self, parent=None, infile=None, inputs=None):
|
def __init__(self, parent=None, infile=None, inputs=None):
|
||||||
super(PropertiesDlg, self).__init__(parent)
|
super(PropertiesDlg, self).__init__(parent)
|
||||||
|
self._pylot_mainwindow = self.parent()
|
||||||
|
|
||||||
self.infile = infile
|
self.infile = infile
|
||||||
self.inputs = inputs
|
self.inputs = inputs
|
||||||
@ -3722,14 +3723,26 @@ class PhasesTab(PropTab):
|
|||||||
class GraphicsTab(PropTab):
|
class GraphicsTab(PropTab):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(GraphicsTab, self).__init__(parent)
|
super(GraphicsTab, self).__init__(parent)
|
||||||
|
self.pylot_mainwindow = parent._pylot_mainwindow
|
||||||
self.init_layout()
|
self.init_layout()
|
||||||
self.add_pg_cb()
|
self.add_pg_cb()
|
||||||
self.add_nth_sample()
|
self.add_nth_sample()
|
||||||
|
self.add_style_settings()
|
||||||
self.setLayout(self.main_layout)
|
self.setLayout(self.main_layout)
|
||||||
|
|
||||||
def init_layout(self):
|
def init_layout(self):
|
||||||
self.main_layout = QGridLayout()
|
self.main_layout = QGridLayout()
|
||||||
|
|
||||||
|
def add_style_settings(self):
|
||||||
|
styles = self.pylot_mainwindow._styles
|
||||||
|
label = QtGui.QLabel('Application style (might require Application restart):')
|
||||||
|
self.style_cb = QComboBox()
|
||||||
|
for stylename, style in styles.items():
|
||||||
|
self.style_cb.addItem(stylename, style)
|
||||||
|
self.main_layout.addWidget(label, 2, 0)
|
||||||
|
self.main_layout.addWidget(self.style_cb, 2, 1)
|
||||||
|
self.style_cb.activated.connect(self.set_current_style)
|
||||||
|
|
||||||
def add_nth_sample(self):
|
def add_nth_sample(self):
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
nth_sample = settings.value("nth_sample")
|
nth_sample = settings.value("nth_sample")
|
||||||
@ -3763,6 +3776,10 @@ class GraphicsTab(PropTab):
|
|||||||
self.main_layout.addWidget(label, 0, 0)
|
self.main_layout.addWidget(label, 0, 0)
|
||||||
self.main_layout.addWidget(self.checkbox_pg, 0, 1)
|
self.main_layout.addWidget(self.checkbox_pg, 0, 1)
|
||||||
|
|
||||||
|
def set_current_style(self):
|
||||||
|
selected_style = self.style_cb.currentText()
|
||||||
|
self.pylot_mainwindow.set_style(selected_style)
|
||||||
|
|
||||||
def getValues(self):
|
def getValues(self):
|
||||||
values = {'nth_sample': self.spinbox_nth_sample.value(),
|
values = {'nth_sample': self.spinbox_nth_sample.value(),
|
||||||
'pyqtgraphic': self.checkbox_pg.isChecked()}
|
'pyqtgraphic': self.checkbox_pg.isChecked()}
|
||||||
|
Loading…
Reference in New Issue
Block a user