def initUI(self): ### Dealing with the Tabs self.myTabs = QTabWidget( self) # Creates the tab widget to hold the tabs self.myTabs.setTabShape(QTabWidget.TabShape(1000)) tabbar = self.myTabs.tabBar() tabbar.setMovable(True) self.views = {} self.models = {} self.myTabs.setStyleSheet(St.StyleSheets['Tab']) for name in act_nums: self.tabWidget = QWidget( ) # Creating a widget to hold a single tab self.views[name] = QTableView( self ) # Creating a table view to eventually put a pandas dataframe in self.views[name].setSizeAdjustPolicy( QAbstractScrollArea.AdjustToContents) self.tabWidget.setStyleSheet(St.StyleSheets['Tab']) self.views[name].setStyleSheet(St.StyleSheets['Table']) ### Change the header fonts Hfont = QFont(*St.Header_Font) self.headers = self.views[name].horizontalHeader() self.headers.setDefaultAlignment(Qt.AlignLeft | Qt.AlignVCenter) self.headers.setFont(Hfont) Ifont = QFont(*St.Item_Font) self.views[name].setFont(Ifont) ### fncs.AllInOneLayout( self.tabWidget, [self.views[name]] ) # add the self.view object to the self.tabWidget object's layout Tfont = QFont(*St.Tab_Font) self.myTabs.setFont(Tfont) self.views[name].setAlternatingRowColors(True) self.myTabs.addTab(self.tabWidget, str(name)) # Add this tab to myTabs self.models[name] = self.createTable( dict_bank_data[name], self.views[name] ) # Call the create table function to create a table ### self.tabbar = self.myTabs.tabBar() self.SearchBar = Search(self) self.SearchBar.setHidden(True) ### Sorting out the Layout fncs.AllInOneLayout( self, [self.myTabs, self.SearchBar], VH='h', Stretches=[4, 1] ) # Add the sidebar_frame and myTabs to the layout of the page horizontally. ### self.show() # show the entire app
def initUI(self): l1 = QLabel("Peek-A-Boo!") font = QFont("Comic Sans", 25) l1.setFont(font) fncs.AllInOneLayout(self, [l1], Align=Qt.AlignCenter) self.show()
def sideBar(self): sidebar_frame = QFrame() sidebar_frame.setMinimumWidth(110) #sidebar_frame.setStyleSheet(St.StyleSheets['Sidebar']) button_titles = ['Data\nTables', 'Plotting', 'Budget'] button_titles = fill_a_list( button_titles, '', St.number_of_buttons_on_sidebar - len(button_titles)) self.buttons = [] but_funcs = [self.onTabButton, self.onPlotButton, self.onBudgetButton] but_funcs = fill_a_list( but_funcs, self.emptyFunc, St.number_of_buttons_on_sidebar - len(but_funcs)) for i in range(St.number_of_buttons_on_sidebar): button = QPushButton(button_titles[i]) button.setStyleSheet(St.StyleSheets['Button%i' % i]) button.clicked.connect(but_funcs[i]) button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) button.setCheckable(True) self.buttons.append(button) Funcs.AllInOneLayout( sidebar_frame, self.buttons, VH='V' ) # add button and button2 to the sidebar_frame vertically, aligning them at the top. #frame_layout.setSizeLayout(QSizePolicy.Expanding, QSizePolicy.Expanding) return sidebar_frame
def initUI(self): self.Date1Button = QPushButton("Date 1") self.Date2Button = QPushButton("Date 2") self.ResetDateButton = QPushButton("Reset Date") self.Date1Button.setFont(QFont(*St.Search_Info_Font)) self.Date2Button.setFont(QFont(*St.Search_Info_Font)) self.ResetDateButton.setFont(QFont(*St.Search_Info_Font)) self.Date1Button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.Date2Button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.ResetDateButton.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.Date1Button.setStyleSheet(St.StyleSheets['Date Buttons']) self.Date2Button.setStyleSheet(St.StyleSheets['Date Buttons']) self.ResetDateButton.setStyleSheet(St.StyleSheets['Date Buttons']) fncs.AllInOneLayout( self, [self.Date1Button, self.Date2Button, self.ResetDateButton], VH='h') self.show()
def initUI(self): # The graph widgets self.Graph = PlotCanvas(False, False, parent=self) self.toolbar = NavBar(self.Graph, self) control_panel = ButtonPanel(self) fncs.AllInOneLayout(self, [self.Graph, control_panel], Stretches=[4, 1], VH='h') self.show()
def whichPlot(self, YParams, Accounts, acc): col = dr.dict_value_get(default_plots[YParams], 'color') col = fncs.colorChange(col, 1 - 0.2 * Accounts.index(acc), [0, 1, 2], Type='scale', output='hex') ls = dr.dict_value_get(default_plots[YParams], 'ls') lw = dr.dict_value_get(default_plots[YParams], 'lw') + Accounts.index(acc) * 0.25 marker = dr.dict_value_get(default_plots[YParams], 'marker') return col, ls, lw, marker
def __init__(self): super().__init__() self.bob = 'bob' self.FullStack = QStackedWidget(self) self.PlotPageStackItem = PlotPage() self.HelpPageStackItem = HelpPage() self.FullStack.addWidget(self.PlotPageStackItem) self.FullStack.addWidget(self.HelpPageStackItem) fncs.AllInOneLayout(self, self.FullStack) self.show()
def initUI(self): self.bxs = {} for name in dict_bank_data[act_nums[0]].columns: self.bxs[name] = QCheckBox(str(name), self) self.bxs[name].setChecked(True) self.bxs[name].setStyleSheet(St.StyleSheets['Check Boxes']) fncs.AllInOneLayout(self, list(self.bxs.values()), VH='h', Align=Qt.AlignTop) self.show()
def initUI(self): # The graph widgets f = open('./Gui/html/Help_Page.html', 'r') help_page_html = f.read() f.close() self.Help_Box = QTextEdit() self.Help_Box.setHtml(help_page_html) self.Help_Box.setReadOnly(True) CFont = QFont(*St.Header_Font) self.Help_Box.setFont(CFont) self.Help_Box.setStyleSheet(St.StyleSheets['Text Frame']) self.Help_Box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) fncs.AllInOneLayout(self, self.Help_Box)
def initUI(self): self.TableStackItem = Table.TablePage() self.PlotStackItem = Plot.App_Bit() self.BudgetStackItem = Budget.SettingsPage() sidebar_frame = self.sideBar() self.FullStack = QStackedWidget(self) self.FullStack.addWidget(self.TableStackItem) self.FullStack.addWidget(self.PlotStackItem) self.FullStack.addWidget(self.BudgetStackItem) self.onTabButton() Funcs.AllInOneLayout(self, [sidebar_frame, self.FullStack], Stretches=[1, 10], VH="H") self.show()
def initUI(self): self.Title = QLabel("Search Bar") self.Title.setAlignment(Qt.AlignCenter) self.Title.setFont(QFont(*St.Title_Font)) self.lineedit = QLineEdit("Search...") self.lineedit.setFont(QFont(*St.Search_Bar_Font)) self.lineedit.setStyleSheet(St.StyleSheets['Search']) self.CheckBoxes = CheckBoxes() self.view = QTableView() self.view.setStyleSheet(St.StyleSheets['Info Table']) self.model = self.createTable(self.parent().search_data, self.view) self.ButtonFrame = DateButtons() self.ButtonFrame.Date1Button.clicked.connect(self.onButtonClick1) self.ButtonFrame.Date2Button.clicked.connect(self.onButtonClick2) self.ButtonFrame.ResetDateButton.clicked.connect(self.DateReset) self.DateLabel = QLabel("") self.DateLabel.setFont(QFont(*St.Search_Info_Font)) self.calender = QCalendarWidget(self) self.calender.setHidden(True) self.calender.clicked.connect(self.closeCalender) self.CatPlot = PlotCanvas([], []) xdata, ydata = stats.catFinder(dict_bank_data[act_nums[0]]) self.CatPlot.plot(xdata, ydata) fncs.AllInOneLayout(self, [ self.Title, self.lineedit, self.CheckBoxes, self.ButtonFrame, self.DateLabel, self.calender, self.view, self.CatPlot ], VH='v', Stretches=[1, 1, 1, 1, 1, 6, 4, 12], Align=Qt.AlignTop) self.show()
def initUI(self): account_label = QLabel("Account:") title_font = QFont(*St.Title_Font) account_label.setFont(title_font) account_label.setStyleSheet(St.StyleSheets['QLabel']) accounts_frame = QFrame(self) self.account_buttons = [ QPushButton(i.replace('Account', ''), self) for i in act_nums ] [ i.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) for i in self.account_buttons ] [i.setCheckable(True) for i in self.account_buttons] [ i.setStyleSheet(St.StyleSheets['Plot Buttons Account']) for i in self.account_buttons ] [i.clicked.connect(self.onAccountClick) for i in self.account_buttons] fncs.AllInOneLayout(accounts_frame, self.account_buttons, VH='h', Align=Qt.AlignTop, Stretches=[1] + [1 for i in self.account_buttons]) plot_params_frame = QFrame(self) self.plot_params_buttons = [ QPushButton(i, self) for i in Plottable_cols ] [ i.setStyleSheet(St.StyleSheets['Plot Buttons Ydata']) for i in self.plot_params_buttons ] [ i.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) for i in self.plot_params_buttons ] [i.setCheckable(True) for i in self.plot_params_buttons] [ i.clicked.connect(self.onPlotParameterClick) for i in self.plot_params_buttons ] fncs.AllInOneLayout(plot_params_frame, self.plot_params_buttons, VH='h', Align=Qt.AlignTop) ydata_label = QLabel("YData:") ydata_label.setFont(title_font) ydata_label.setStyleSheet(St.StyleSheets['QLabel']) groupby_frame = QFrame(self) groupby_label = QLabel("Resample:") groupby_label.setFont(title_font) groupby_combo_box = QComboBox(self) [ groupby_combo_box.addItem(i) for i in ['None', 'Daily', 'Weekly', 'Monthly', 'Quarterly', 'Yearly'] ] groupby_combo_box.setStyleSheet(St.StyleSheets['Combo Box']) groupby_combo_box.activated[str].connect(self.onComboBox) fncs.AllInOneLayout(groupby_frame, [groupby_label, groupby_combo_box], VH='h') spacer = QLabel("") fncs.AllInOneLayout(self, [ account_label, accounts_frame, ydata_label, plot_params_frame, spacer, groupby_frame, spacer ], VH='V', Align=Qt.AlignTop, Stretches=[1, 1, 1, 1, 0.2, 1, 10])
{ background-color: %s; border: 0; } QScrollBar::add-line:vertical { border: none; background: %s; } QScrollBar::sub-line:vertical { border: none; background: %s; } """%(f.colorChange(table_background_color, 0.97, [0,1,2], 'scale'), table_background_color, table_background_color, table_background_color, table_background_color, table_background_color, table_background_color, table_background_color) StyleSheets['Tab'] = """ QTabBar::tab { background-color: %s; height: 45px; width: 160px; } QTabWidget::pane { background-color: white; } QTabBar::tab::selected { background-color: white;