[add] dark stylesheet
This commit is contained in:
		
							parent
							
								
									7f0d3c2ab4
								
							
						
					
					
						commit
						7ecf976401
					
				
							
								
								
									
										36
									
								
								QtPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								QtPyLoT.py
									
									
									
									
									
								
							@ -578,7 +578,7 @@ class MainWindow(QMainWindow):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        # create central matplotlib figure canvas widget
 | 
					        # create central matplotlib figure canvas widget
 | 
				
			||||||
        self.pg = pg
 | 
					        self.pg = pg
 | 
				
			||||||
        #self.set_style('custom')
 | 
					        #self.set_style('dark')
 | 
				
			||||||
        self.init_wfWidget()
 | 
					        self.init_wfWidget()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # init main widgets for main tabs
 | 
					        # init main widgets for main tabs
 | 
				
			||||||
@ -668,36 +668,21 @@ class MainWindow(QMainWindow):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def init_styles(self):
 | 
					    def init_styles(self):
 | 
				
			||||||
        self._styles = {}
 | 
					        self._styles = {}
 | 
				
			||||||
        styles = ['default', 'dark', 'custom']
 | 
					        styles = ['default', 'dark']
 | 
				
			||||||
        for style in styles:
 | 
					        for style in styles:
 | 
				
			||||||
            self._styles[style] = {}
 | 
					            self._styles[style] = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._styles['default']['stylesheet'] = ("QMainWindow {background-color: rgba(200, 200, 200, 255)}")
 | 
					 | 
				
			||||||
            # ;"
 | 
					 | 
				
			||||||
            #                                      "alternate-background-color: rgba(255, 0, 255, 255);"
 | 
					 | 
				
			||||||
            #                                      "color: rgba(0, 0, 0, 255);"
 | 
					 | 
				
			||||||
            #                                      "gridline-color: rgba(0, 0, 0, 255);"
 | 
					 | 
				
			||||||
            #                                      "selection-background-color: rgba(50, 50, 150, 255)};"
 | 
					 | 
				
			||||||
            #                                      "QMainWindow {background-color: red}")
 | 
					 | 
				
			||||||
        self._styles['default']['background'] = 'w'
 | 
					        self._styles['default']['background'] = 'w'
 | 
				
			||||||
        self._styles['default']['foreground'] = 'k'
 | 
					        self._styles['default']['foreground'] = 'k'
 | 
				
			||||||
 | 
					        self._styles['default']['stylesheet'] = self.styleSheet()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._styles['dark']['stylesheet'] = ("QWidget {background-color: rgba(50, 50, 60, 255);"
 | 
					 | 
				
			||||||
                                              "alternate-background-color: rgba(100, 100, 150, 255);"
 | 
					 | 
				
			||||||
                                              "border-color: rgba(200, 200, 200, 255);"
 | 
					 | 
				
			||||||
                                              "color: rgba(255, 255, 255, 255);"
 | 
					 | 
				
			||||||
                                              "gridline-color: rgba(255, 255, 255, 255);"
 | 
					 | 
				
			||||||
                                              "selection-background-color: rgba(50, 50, 150, 255)}")
 | 
					 | 
				
			||||||
        self._styles['dark']['background'] = QtGui.QColor(50, 50, 65, 255)
 | 
					        self._styles['dark']['background'] = QtGui.QColor(50, 50, 65, 255)
 | 
				
			||||||
        self._styles['dark']['foreground'] = 'w'
 | 
					        self._styles['dark']['foreground'] = 'w'
 | 
				
			||||||
 | 
					        # TODO: improve this
 | 
				
			||||||
        infile = open('./pylot/core/util/stylesheet.qss', 'r')
 | 
					        infile = open('./styles/dark.qss', 'r')
 | 
				
			||||||
        stylesheet = infile.read()
 | 
					        stylesheet = infile.read()
 | 
				
			||||||
        infile.close()
 | 
					        infile.close()
 | 
				
			||||||
        self._styles['custom']['stylesheet'] = stylesheet
 | 
					        self._styles['dark']['stylesheet'] = stylesheet
 | 
				
			||||||
        self._styles['custom']['background'] = QtGui.QColor(50, 50, 65, 255)
 | 
					 | 
				
			||||||
        self._styles['custom']['foreground'] = 'w'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def set_style(self, stylename):
 | 
					    def set_style(self, stylename):
 | 
				
			||||||
        if not stylename in self._styles:
 | 
					        if not stylename in self._styles:
 | 
				
			||||||
@ -708,6 +693,15 @@ class MainWindow(QMainWindow):
 | 
				
			|||||||
        style = self._styles[stylename]
 | 
					        style = self._styles[stylename]
 | 
				
			||||||
        self.setStyleSheet(style['stylesheet'])
 | 
					        self.setStyleSheet(style['stylesheet'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bg_colors = [60, 60, 70]
 | 
				
			||||||
 | 
					        bg_colors = [color/255. for color in bg_colors]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        cycler = matplotlib.cycler(color='wbgrcmy')
 | 
				
			||||||
 | 
					        matplotlib.rcParams['axes.prop_cycle'] = cycler
 | 
				
			||||||
 | 
					        matplotlib.rcParams['axes.facecolor'] = '({}, {}, {})'.format(*bg_colors)
 | 
				
			||||||
 | 
					        matplotlib.rcParams['figure.facecolor'] = '({}, {}, {})'.format(*bg_colors)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if self.pg:
 | 
					        if self.pg:
 | 
				
			||||||
            pg.setConfigOption('background', style['background'])
 | 
					            pg.setConfigOption('background', style['background'])
 | 
				
			||||||
            pg.setConfigOption('foreground', style['foreground'])
 | 
					            pg.setConfigOption('foreground', style['foreground'])
 | 
				
			||||||
 | 
				
			|||||||
@ -926,7 +926,7 @@ class PylotCanvas(FigureCanvas):
 | 
				
			|||||||
                    trace.normalize(np.max(np.abs(trace.data)) * 2)
 | 
					                    trace.normalize(np.max(np.abs(trace.data)) * 2)
 | 
				
			||||||
                times = [time for index, time in enumerate(time_ax) if not index % nth_sample]
 | 
					                times = [time for index, time in enumerate(time_ax) if not index % nth_sample]
 | 
				
			||||||
                data = [datum + n for index, datum in enumerate(trace.data) if not index % nth_sample]
 | 
					                data = [datum + n for index, datum in enumerate(trace.data) if not index % nth_sample]
 | 
				
			||||||
                ax.plot(times, data, 'k', linewidth=0.7)
 | 
					                ax.plot(times, data, linewidth=0.7)
 | 
				
			||||||
                if noiselevel is not None:
 | 
					                if noiselevel is not None:
 | 
				
			||||||
                    for level in noiselevel:
 | 
					                    for level in noiselevel:
 | 
				
			||||||
                        ax.plot([time_ax[0], time_ax[-1]],
 | 
					                        ax.plot([time_ax[0], time_ax[-1]],
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										188
									
								
								styles/dark.qss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								styles/dark.qss
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,188 @@
 | 
				
			|||||||
 | 
					QMainWindow{
 | 
				
			||||||
 | 
					background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QWidget{
 | 
				
			||||||
 | 
					background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(70, 70, 80, 255), stop:1 rgba(60, 60, 70, 255));
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QComboBox{
 | 
				
			||||||
 | 
					background-color: rgba(80, 80, 90, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QComboBox *{
 | 
				
			||||||
 | 
					background-color: rgba(80, 80, 90, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QMenuBar{
 | 
				
			||||||
 | 
					background-color: rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					padding:1px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QMenuBar::item{
 | 
				
			||||||
 | 
					background-color: rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					padding:3px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QMenu{
 | 
				
			||||||
 | 
					background-color: rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					padding:0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QMenu::item:selected{
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					background-color: rgba(200, 210, 230, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QToolBar{
 | 
				
			||||||
 | 
					border-style:solid;
 | 
				
			||||||
 | 
					border-color:rgba(70, 70, 80, 255);
 | 
				
			||||||
 | 
					border-width:1px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QFileDialog QLabel{
 | 
				
			||||||
 | 
					color: rgba(0, 0, 0, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QFileDialog QPushButton{
 | 
				
			||||||
 | 
					background-color: rgba(210, 210, 210, 255);
 | 
				
			||||||
 | 
					color: rgba(0, 0, 0, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QMessageBox{
 | 
				
			||||||
 | 
					background-color: rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTableWidget{
 | 
				
			||||||
 | 
					background-color: rgba(70, 70, 80, 255);
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					border-color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					selection-background-color: rgba(200, 210, 230, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QHeaderView::section{
 | 
				
			||||||
 | 
					background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
 | 
				
			||||||
 | 
					border:none;
 | 
				
			||||||
 | 
					border-top-style:solid;
 | 
				
			||||||
 | 
					border-width:1px;
 | 
				
			||||||
 | 
					border-top-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					padding:5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QHeaderView{
 | 
				
			||||||
 | 
					background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(60, 60, 70, 255), stop:1 rgba(70, 70, 80, 255));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					border:none;
 | 
				
			||||||
 | 
					border-top-style:solid;
 | 
				
			||||||
 | 
					border-width:1px;
 | 
				
			||||||
 | 
					border-top-color:rgba(70, 70, 80, 255);
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QListWidget{
 | 
				
			||||||
 | 
					background-color:rgba(200, 200, 200, 255);
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QStatusBar{
 | 
				
			||||||
 | 
					background-color:rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QPushButton{
 | 
				
			||||||
 | 
					background-color:rgba(70, 70, 80, 255);
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QPushButton:pressed{
 | 
				
			||||||
 | 
					background-color: rgba(70, 70, 80, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabBar{
 | 
				
			||||||
 | 
					background-color:transparent
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabBar::tab{
 | 
				
			||||||
 | 
					background-color:rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					border-style:solid;
 | 
				
			||||||
 | 
					border-color:rgba(80, 80, 90, 255);
 | 
				
			||||||
 | 
					border-bottom-color: transparent;
 | 
				
			||||||
 | 
					border-width:1px;
 | 
				
			||||||
 | 
					padding:5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabBar::tab:selected{
 | 
				
			||||||
 | 
					background-color:rgba(80, 80, 90, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					border-style:solid;
 | 
				
			||||||
 | 
					border-color:rgba(80, 80, 90, 255);
 | 
				
			||||||
 | 
					border-bottom-color: transparent;
 | 
				
			||||||
 | 
					border-width:1px;
 | 
				
			||||||
 | 
					padding:5px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabWidget{
 | 
				
			||||||
 | 
					background-color:transparent;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabWidget::pane{
 | 
				
			||||||
 | 
					background-color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					border-style:solid;
 | 
				
			||||||
 | 
					border-color:rgba(80, 80, 90, 255);
 | 
				
			||||||
 | 
					border-width:1px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabWidget::tab{
 | 
				
			||||||
 | 
					background-color:rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTabWidget > QWidget{
 | 
				
			||||||
 | 
					background-color: rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QScrollArea{
 | 
				
			||||||
 | 
					background: transparent;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QScrollArea>QWidget>QWidget{
 | 
				
			||||||
 | 
					background: transparent;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QLabel{
 | 
				
			||||||
 | 
					color: rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					background-color: transparent;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QLineEdit{
 | 
				
			||||||
 | 
					border-radius:0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QListWidget{
 | 
				
			||||||
 | 
					background-color:rgba(60, 60, 70, 255)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QProgressBar{
 | 
				
			||||||
 | 
					border-radius:0;
 | 
				
			||||||
 | 
					text-align:center;
 | 
				
			||||||
 | 
					color:rgba(255, 255, 255, 255);
 | 
				
			||||||
 | 
					background-color:rgba(60,60,80,255);
 | 
				
			||||||
 | 
					border: 2px solid #e3a21a;
 | 
				
			||||||
 | 
					border-radius:7px;
 | 
				
			||||||
 | 
						font: 75 12pt "Open Sans";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QProgressBar::chunk{
 | 
				
			||||||
 | 
					background-color:rgba(60, 60, 70, 255);
 | 
				
			||||||
 | 
					width:10px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user