def __init__(self): """ Application side panel. Contains room, groups and skills lists. :param config: application's parsed configuration """ QTabWidget.__init__(self) self.setMinimumSize(QSize(300, 500)) self.setTabPosition(QTabWidget.South) self.setTabsClosable(False) self.tabBar().setIconSize(QSize(46, 46)) # widgets self.courses_panel = ViewCoursePanel(self.minimumWidth()) self.students_panel = ViewStudentPanel() self.attributes_panel = ViewAttributePanel() # Tabs self.addTab(self.courses_panel, get_icon("classroom"), "") self.setTabToolTip(0, tr("crs_tab_tooltip")) self.addTab(self.students_panel, get_icon("magic"), "") self.setTabToolTip(1, tr("grp_tab_tooltip")) self.addTab(self.attributes_panel, get_icon("competence"), "") self.setTabToolTip(2, tr("attr_tab_tooltip")) self.setStyleSheet(get_stylesheet("tabbar"))
def __init__(self, code_list, owner): QTabWidget.__init__(self) self.CONFIRM = 'press enter again to confirm (backspace to cancel)' self.is_confirming = False self.owner = owner self.num_keys = ( Qt.Key_0, Qt.Key_1, Qt.Key_2, Qt.Key_3, Qt.Key_4, Qt.Key_5, Qt.Key_6, Qt.Key_7, Qt.Key_8, Qt.Key_9) self.number = [] colors = [] for code in code_list: if code.color not in colors: colors.append(code.color) self.setAutoFillBackground(True) self.setTabBar(QTabBar()) self.list_views = [] for i in range(len(colors)): print(colors[i]) list_widget = QListWidget(self) list_widget.setSelectionMode(QAbstractItemView.ExtendedSelection) list_widget.setFont(QFont('Source Code Pro', 16)) self.list_views.append(list_widget) count = 0 for code in code_list: if code.color != colors[i]: continue # create an item with a caption item = QListWidgetItem(f'{str(count)} - {code.code_name}') count += 1 item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable) # Add the item to the model # if list.count() list_widget.addItem(item) self.addTab(list_widget, str(i)) list_widget.setAutoFillBackground(True) list_widget.setStyleSheet("QWidget {{background-color: {0};}}".format(colors[i])) self.convert_old_data()
def __init__(self, status_message, active_tab_changed): """ Application's central widget, contains all the app's widgets. :param status_message: Status bar function to call to display a message :param active_tab_changed: Method to call when the tab changed, in order to update the content of the toolbar. Call with True if the new active tab is the classroom's one. """ QTabWidget.__init__(self) # Init self.status_message = status_message self.is_view_students: bool = None # Current view self.setTabPosition(QTabWidget.South) self.setTabsClosable(False) # Widgets self.classroom_tab = ClassRoomTab(self.sig_move_animation_ended) self.attributes_tab = AttributesTab() # Callbacks self.classroom_tab.view_students.on_click = self.on_perspective_changed self.classroom_tab.view_teacher.on_click = self.on_perspective_changed # Signals self.sig_shuffle = None self.sig_enable_animation_btns = None # When the move animation ends, we can re-activate the buttons self.sig_move_animation_ended.connect( lambda: self.sig_enable_animation_btns.emit(True)) self.currentChanged.connect( lambda: active_tab_changed(self.currentIndex() == 0)) self.__set_layout() self.on_perspective_changed( ) # This will switch the is_view_student flag and display the students' view
def __init__(self, parent=None): QTabWidget.__init__(self, parent)
def __init__(self, parent=None): self.widget = QTabWidget.__init__(self, parent) self.tb = TabBar() self.setTabBar(self.tb) self.setTabPosition(QTabWidget.West)
def __init__(self, ui_class, parent=None): QTabWidget.__init__(self, parent) self.ui = ui_class() self.ui.setupUi(self)