def __init__(self, bookmarks: BookmarkList): Tab.__init__(self) self.name = "Bookmarks" self.bookmarks = bookmarks self.new_bookmarks = [] self.removed_bookmarks = [] self.header_win = windows.ColumnHeaderWin(('room@server/nickname', 'password', 'autojoin', 'storage')) self.bookmarks_win = windows.BookmarksWin(self.bookmarks, self.height-4, self.width, 1, 0) self.help_win = windows.HelpText(_('Ctrl+Y: save, Ctrl+G: cancel, ' '↑↓: change lines, tab: change ' 'column, M-a: add bookmark, C-k' ': delete bookmark')) self.info_header = windows.BookmarksInfoWin() self.key_func['KEY_UP'] = self.bookmarks_win.go_to_previous_line_input self.key_func['KEY_DOWN'] = self.bookmarks_win.go_to_next_line_input self.key_func['^I'] = self.bookmarks_win.go_to_next_horizontal_input self.key_func['^G'] = self.on_cancel self.key_func['^Y'] = self.on_save self.key_func['M-a'] = self.add_bookmark self.key_func['^K'] = self.del_bookmark self.resize() self.update_commands()
def resize(self): self.need_resize = False self.topic_win.resize(1, self.width, 0, 0) self.form_win.resize(self.height-3 - Tab.tab_win_height(), self.width, 1, 0) self.help_win.resize(1, self.width, self.height-1, 0) self.help_win_dyn.resize(1, self.width, self.height-2 - Tab.tab_win_height(), 0) self.lines = []
def __init__(self, bookmarks: BookmarkList): Tab.__init__(self) self.name = "Bookmarks" self.bookmarks = bookmarks self.new_bookmarks = [] self.removed_bookmarks = [] self.header_win = windows.ColumnHeaderWin(('room@server/nickname', 'password', 'autojoin', 'storage')) self.bookmarks_win = windows.BookmarksWin(self.bookmarks, self.height-4, self.width, 1, 0) self.help_win = windows.HelpText('Ctrl+Y: save, Ctrl+G: cancel, ' '↑↓: change lines, tab: change ' 'column, M-a: add bookmark, C-k' ': delete bookmark') self.info_header = windows.BookmarksInfoWin() self.key_func['KEY_UP'] = self.bookmarks_win.go_to_previous_line_input self.key_func['KEY_DOWN'] = self.bookmarks_win.go_to_next_line_input self.key_func['^I'] = self.bookmarks_win.go_to_next_horizontal_input self.key_func['^G'] = self.on_cancel self.key_func['^Y'] = self.on_save self.key_func['M-a'] = self.add_bookmark self.key_func['^K'] = self.del_bookmark self.resize() self.update_commands()
def resize(self): self.need_resize = False self.topic_win.resize(1, self.width, 0, 0) self.form_win.resize(self.height - 3 - Tab.tab_win_height(), self.width, 1, 0) self.help_win.resize(1, self.width, self.height - 1, 0) self.help_win_dyn.resize(1, self.width, self.height - 2 - Tab.tab_win_height(), 0) self.lines = []
def load_tabs(self): if self.template != None: tabIndex = 0 for tab in self.template.iter("tab"): widget = Tab(self, tabIndex, tab) tabIndex += 1 self.tabs.addTab(widget, tab.find("title").text)
def __init__(self, parent): super(QWidget, self).__init__(parent) self.parent = parent mainLayout = QHBoxLayout() layout_v = QVBoxLayout() #--- figure figure = MyMplCanvas(parent=self, width=6, height=6, isAxis=False) #---control panel control = Tab(self) #--- log log = QTextEdit() log.setReadOnly(True) # setup layout layout_v.addWidget(control) layout_v.addWidget(log) mainLayout.addLayout(layout_v, stretch=3) mainLayout.addWidget(figure,stretch=5) self.setLayout(mainLayout) #-- set self self.setSelf(figure=figure,log=log) self.showTextInLog("Software initialized.")
def on_info_win_size_changed(self): if self.core.information_win_size >= self.height - 3: return info_height = self.core.information_win_size tab_height = Tab.tab_win_height() self.bookmarks_win.resize(self.height - 3 - tab_height - info_height, self.width, 1, 0) self.info_header.resize(1, self.width, self.height - 2 - tab_height - info_height, 0)
def __init__(self, form, on_cancel, on_send, kwargs): Tab.__init__(self) self._form = form self._on_cancel = on_cancel self._on_send = on_send self._kwargs = kwargs self.fields = [] for field in self._form: self.fields.append(field) self.topic_win = windows.Topic() self.form_win = windows.FormWin(form, self.height-4, self.width, 1, 0) self.help_win = windows.HelpText("Ctrl+Y: send form, Ctrl+G: cancel") self.help_win_dyn = windows.HelpText() self.key_func['KEY_UP'] = self.form_win.go_to_previous_input self.key_func['KEY_DOWN'] = self.form_win.go_to_next_input self.key_func['^G'] = self.on_cancel self.key_func['^Y'] = self.on_send self.resize() self.update_commands()
def __init__(self): super(TabWindow, self).__init__() self.tabs_names = ['Methods', 'Local errors', 'Approximation Errors'] self.tabs = {str: Tab} self.tabs = { k: v for k, v in zip(self.tabs_names, ( Tab(self) for i in range(len(self.tabs_names)))) } self.insert_tabs()
def resize(self): self.need_resize = False self.header_win.resize_columns({ 'room@server/nickname': self.width//3, 'password': self.width//3, 'autojoin': self.width//6, 'storage': self.width//6 }) info_height = self.core.information_win_size tab_height = Tab.tab_win_height() self.header_win.resize(1, self.width, 0, 0) self.bookmarks_win.resize(self.height - 3 - tab_height - info_height, self.width, 1, 0) self.help_win.resize(1, self.width, self.height - 1, 0) self.info_header.resize(1, self.width, self.height - 2 - tab_height - info_height, 0)