def createLeftSide(self): self.leftSideGB = QGroupBox() home_directory = "./app/" palette = QPalette() palette.setColor(QPalette.Window, QColor(30, 30, 30)) model = QDirModel() view = QTreeView() view.setStyleSheet("QTreeView { border: 0px; }") view.setModel(model) view.setRootIndex(model.index(home_directory)) view.setColumnHidden(1, True) view.setColumnHidden(2, True) view.setColumnHidden(3, True) view.show() view.setPalette(palette) runButton = QPushButton("►") stopButton = QPushButton("❚❚") bottomBar = QHBoxLayout() bottomBar.addWidget(runButton) bottomBar.addWidget(stopButton) layout = QVBoxLayout() layout.addWidget(view) layout.addLayout(bottomBar) layout.setStretch(0, 2) self.leftSideGB.setLayout(layout)
class FullColorPickerWidget(QWidget): color_changed = Signal(QColor) def __init__(self, title: str, parent=None): super().__init__(parent) self.__color_picker = QColorDialog(self) self.__color_picker.setOption(QColorDialog.ColorDialogOption.DontUseNativeDialog) self.__color_picker.setOption(QColorDialog.ColorDialogOption.NoButtons) self.__color_picker.setWindowFlags(Qt.Widget) self.__group_box = QGroupBox(title) self.__group_box_layout = QVBoxLayout() self.__group_box_layout.addWidget(self.__color_picker) self.__group_box.setLayout(self.__group_box_layout) self.__group_box_layout.setStretch(1, 1) self.__main_layout = QVBoxLayout(self) self.__main_layout.addWidget(self.__group_box) @Slot(QColor) def __on_color_changed(self, color: QColor): self.color_changed.emit(color) def get_current_color(self) -> QColor: return self.__color_picker.currentColor()
def endInitButtons(self): buttonsLayout = QVBoxLayout() buttonsLayout.setStretch(0, 1) buttonsLayout.addWidget(self.tableWidget) self.windowLayout.addLayout(buttonsLayout) self.setGeometry(self.left, self.top, 140 + self.BtnW * 100, 175 if self.BtnH * 31 < 175 else 25 + self.BtnH * 30)
def test_text(pixmap_differ: PixmapDiffer): actual: QPainter expected: QPainter with pixmap_differ.create_painters( 300, 240, 'scaled_radio_button_text') as (actual, expected): ex_widget = QWidget() ex_layout = QVBoxLayout(ex_widget) ex_radio1 = QRadioButton('Lorem ipsum') ex_radio2 = QRadioButton('Lorem ipsum') ex_font = ex_radio1.font() if ex_font.family() == 'Sans Serif': # Fonts are different on Travis CI. big_font_size = 26 small_font_size = 25 ex_radio1.setStyleSheet('QRadioButton::indicator {width: 26} ' 'QRadioButton {spacing: 13}') ex_radio2.setStyleSheet('QRadioButton::indicator {width: 25} ' 'QRadioButton {spacing: 12}') else: big_font_size = 29 small_font_size = 28 ex_radio1.setStyleSheet('QRadioButton::indicator {width: 29} ' 'QRadioButton {spacing: 14}') ex_radio2.setStyleSheet('QRadioButton::indicator {width: 28} ' 'QRadioButton {spacing: 14}') ex_font.setPointSize(big_font_size) ex_radio1.setFont(ex_font) ex_font.setPointSize(small_font_size) ex_radio2.setFont(ex_font) ex_size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) ex_radio1.setSizePolicy(ex_size_policy) ex_radio2.setSizePolicy(ex_size_policy) ex_layout.addWidget(ex_radio1) ex_layout.addWidget(ex_radio2) ex_layout.setStretch(0, 4) ex_layout.setStretch(1, 1) ex_widget.resize(300, 240) expected.drawPixmap(0, 0, ex_widget.grab()) widget = QWidget() layout = QVBoxLayout(widget) radio1 = ScaledRadioButton('Lorem ipsum') radio2 = ScaledRadioButton('Lorem ipsum') size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) radio1.setSizePolicy(size_policy) radio2.setSizePolicy(size_policy) layout.addWidget(radio1) layout.addWidget(radio2) layout.setStretch(0, 4) layout.setStretch(1, 1) widget.resize(300, 240) actual.drawPixmap(0, 0, widget.grab())
def test_text(pixmap_differ: PixmapDiffer): actual: QPainter expected: QPainter with pixmap_differ.create_painters(300, 240, 'scaled_label_text') as ( actual, expected): ex_widget = QWidget() ex_layout = QVBoxLayout(ex_widget) ex_label1 = QLabel('Lorem ipsum') ex_label2 = QLabel('Lorem ipsum') ex_font = ex_label1.font() if ex_font.family() == 'Sans Serif': # Fonts are different on Travis CI. big_font_size = 30 small_font_size = 25 else: big_font_size = 35 small_font_size = 28 ex_font.setPointSize(big_font_size) ex_label1.setFont(ex_font) ex_font.setPointSize(small_font_size) ex_label2.setFont(ex_font) ex_size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) ex_label1.setSizePolicy(ex_size_policy) ex_label1.setAlignment(Qt.AlignBottom) ex_label2.setAlignment(Qt.AlignTop) ex_label2.setSizePolicy(ex_size_policy) ex_layout.addWidget(ex_label1) ex_layout.addWidget(ex_label2) ex_layout.setStretch(0, 4) ex_layout.setStretch(1, 1) ex_widget.resize(300, 240) expected.drawPixmap(0, 0, ex_widget.grab()) widget = QWidget() layout = QVBoxLayout(widget) label1 = ScaledLabel('Lorem ipsum') label2 = ScaledLabel('Lorem ipsum') size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) label1.setSizePolicy(size_policy) label2.setSizePolicy(size_policy) label1.setScaledContents(True) label2.setScaledContents(True) label1.setAlignment(Qt.AlignBottom) label2.setAlignment(Qt.AlignTop) layout.addWidget(label1) layout.addWidget(label2) layout.setStretch(0, 4) layout.setStretch(1, 1) widget.resize(300, 240) actual.drawPixmap(0, 0, widget.grab())
def test_pixmap(pixmap_differ: PixmapDiffer): actual: QPainter expected: QPainter with pixmap_differ.create_painters(300, 240, 'scaled_label_pixmap') as ( actual, expected): ex_widget = QWidget() ex_widget.resize(300, 240) expected.drawPixmap(0, 0, ex_widget.grab()) icon = GridDisplay.create_icon(GridDisplay.player2_colour) expected.drawPixmap(0, 0, icon.scaled(120, 120, Qt.KeepAspectRatio, Qt.SmoothTransformation)) expected.drawPixmap(110, 120, icon.scaled(80, 80, Qt.KeepAspectRatio, Qt.SmoothTransformation)) expected.drawPixmap(260, 200, icon.scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)) widget = QWidget() layout = QVBoxLayout(widget) label1 = ScaledLabel() label2 = ScaledLabel() label3 = ScaledLabel() label1.setPixmap(icon) label2.setPixmap(icon) label3.setPixmap(icon) size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) label1.setSizePolicy(size_policy) label2.setSizePolicy(size_policy) label3.setSizePolicy(size_policy) label1.setScaledContents(True) label2.setScaledContents(True) label3.setScaledContents(True) label1.setAlignment(Qt.AlignLeft) label2.setAlignment(Qt.AlignCenter) label3.setAlignment(Qt.AlignRight) layout.addWidget(label1) layout.addWidget(label2) layout.addWidget(label3) layout.setStretch(0, 3) layout.setStretch(1, 2) layout.setStretch(2, 1) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) widget.resize(300, 240) actual.drawPixmap(0, 0, widget.grab())
def settings(self): self.tableWidget.clear() self.tableWidget.clearSpans() self.tableWidget.setColumnWidth(2, 100) self.cdColorPicker.setVisible(False) self.tableWidget.setColumnCount(2) self.tableWidget.setRowCount(4) self.tableWidget.horizontalHeader().setSectionResizeMode( 0, QHeaderView.Stretch) self.tableWidget.horizontalHeader().hide() # bouton validation pb = QPushButton('Valider') self.tableWidget.setCellWidget(3, 0, pb) pb.clicked.connect(self.saveSettings) # bouton annulation pb = QPushButton('Annuler') self.tableWidget.setCellWidget(3, 1, pb) pb.clicked.connect(self.refreshUI) # parameters self.tableWidget.setSpan(0, 0, 1, 2) self.lAlert = QLabel("La modification de ces valeurs entrainera la " "modification de position des boutons") self.lAlert.setStyleSheet("font-weight: bold;") self.tableWidget.setCellWidget(0, 0, self.lAlert) self.tableWidget.setCellWidget(1, 0, QLabel('Nombre de boutons en Hauteur')) self.leH = QLineEdit(str(self.data_buttons['buttons_grid']['height'])) self.tableWidget.setCellWidget(1, 1, self.leH) self.tableWidget.setCellWidget(2, 0, QLabel('Nombre de boutons en Largeur')) self.leW = QLineEdit(str(self.data_buttons['buttons_grid']['width'])) self.tableWidget.setCellWidget(2, 1, self.leW) settingsLayout = QVBoxLayout() settingsLayout.setStretch(0, 1) settingsLayout.addWidget(self.tableWidget) self.windowLayout.addLayout(settingsLayout) self.setGeometry(self.left, self.top, 600, 300)
def __init__(self, config, resource): QWidget.__init__(self) self.path = config["record_dir"] + "/tests" self.threadpool = resource["threadpool"] self.log_list = QListWidget() self.log_list.itemClicked.connect(self.log_clicked) self.folder_list = QListWidget() self.folder_list.itemClicked.connect(self.folder_clicked) # Create overall layout columns = QHBoxLayout(self) list_rows = QVBoxLayout() columns.addLayout(list_rows) edit_rows = QVBoxLayout() columns.addLayout(edit_rows) columns.setStretch(0, 1) columns.setStretch(1, 5) list_rows.addWidget(self.folder_list) list_rows.addWidget(self.log_list) list_rows.setStretch(0, 1) list_rows.setStretch(1, 3) # create edit_rows self.title_bar = func.label("Select file on left to view log.") edit_rows.addWidget(self.title_bar) self.editor = QPlainTextEdit() edit_rows.addWidget(self.editor) controls = QHBoxLayout() edit_rows.addLayout(controls) # create control buttons buttons = [["Reload", "Update Logs", self.reload], ["Open Folder", "Show Log Folder", self.open_explorer]] for button in buttons: controls.addWidget(func.button(*button)) self.reload()
class VedioUI(QWidget): def __init__(self): super(VedioUI, self).__init__() #定义视频总时长(分钟/秒钟),当前播放到的时间(单位ms) self.vedio_duration_total = '00:00' self.vedio_duration_now = 0 #定义窗口和播放器 self.player = QMediaPlayer(self) self.video_widget = myQVideoWidget() self.video_widget.resize(self.width(), self.height()) self.player.setVideoOutput(self.video_widget) #设置按钮 self.start_pause_btn = QPushButton(self) self.stop_btn = QPushButton(self) self.fast_btn = QPushButton(self) self.back_btn = QPushButton(self) self.screenshot_btn = QPushButton(self) #设定时间块 self.time_label = QLabel(self) self.time_label.setText('--/--') self.progress_slider = QSlider(self) self.progress_slider.setEnabled(False) #没有视频播放时,进度条不可使用 self.progress_slider.setOrientation(Qt.Horizontal) #进度条移动事件 self.progress_slider.sliderMoved.connect(self.move_position) #设定图标 self.start_pause_btn.setIcon(QIcon('ico/pause.png')) self.stop_btn.setIcon(QIcon('ico/stop.png')) self.fast_btn.setIcon(QIcon('ico/fast_forward.png')) self.back_btn.setIcon(QIcon('ico/back_forward.png')) self.screenshot_btn.setIcon(QIcon('ico/screenshot.png')) #点击链接 self.start_pause_btn.clicked.connect( lambda: self.btn_func(self.start_pause_btn)) self.stop_btn.clicked.connect(lambda: self.btn_func(self.stop_btn)) self.fast_btn.clicked.connect(lambda: self.btn_func(self.fast_btn)) self.back_btn.clicked.connect(lambda: self.btn_func(self.back_btn)) self.screenshot_btn.clicked.connect( lambda: self.btn_func(self.screenshot_btn)) #获取视频时间 self.player.durationChanged.connect(self.get_duration) #更新进度条 self.player.positionChanged.connect(self.update_position) #界面布局 self.h1_layout = QHBoxLayout() self.h2_layout = QHBoxLayout() self.v_layout = QVBoxLayout() self.h1_layout.addWidget(self.progress_slider) self.h1_layout.addWidget(self.time_label) self.h2_layout.addWidget(self.back_btn) self.h2_layout.addWidget(self.start_pause_btn) self.h2_layout.addWidget(self.stop_btn) self.h2_layout.addWidget(self.fast_btn) self.h2_layout.addWidget(self.screenshot_btn) self.v_layout.addWidget(self.video_widget) self.v_layout.addLayout(self.h1_layout) self.v_layout.addLayout(self.h2_layout) self.v_layout.setStretch(0, 1) self.setLayout(self.v_layout) #设定窗口名称及大小 self.setWindowTitle("视频播放") self.resize(1024, 768) #居中显示 self.center() #文件加载与播放 def vedio_show(self, vedio_dir=None): if vedio_dir: #添加播放文件 self.media_content = QMediaContent(QUrl.fromLocalFile(vedio_dir)) self.player.setMedia(self.media_content) #声音 self.player.setVolume(50) #开始播放 self.player.play() else: QMessageBox.critical(self,'文件打开失败',\ '1.文件扩展名与文件类型不匹配!\n2.路径中请勿含有中文字符!\n3.文件损坏!\n4.文件无法读取!') exit(-1) #按键链接 def btn_func(self, btn): pass if btn == self.start_pause_btn: # 0停止状态 1正在播放 2暂停状态 if self.player.state() == 1: self.player.pause() self.start_pause_btn.setIcon(QIcon('ico/start.png')) else: self.player.play() self.start_pause_btn.setIcon(QIcon('ico/pause.png')) # elif btn == self.stop_btn: # elif btn == self.fast_btn: # elif btn == self.back_btn: elif btn == self.screenshot_btn: self.player.pause() self.start_pause_btn.setIcon(QIcon('ico/start.png')) QMessageBox.information(self, "提示", '请框取集装箱编号区域') #鼠标修改 self.video_widget.setCursor(Qt.CrossCursor) self.video_widget.select_on() #让屏幕居中 def center(self): #获取屏幕坐标系 screen = QDesktopWidget().screenGeometry() #获取窗口坐标系 size = self.geometry() newLeft = (screen.width() - size.width()) / 2 newTop = (screen.height() - size.height()) / 2 self.move(newLeft, newTop) #将ms转化成 分钟:秒钟 def time_conversion(self, d): seconds = int(d / 1000) minutes = int(seconds / 60) seconds -= minutes * 60 return '{}:{}'.format(minutes, seconds) #设置QLable的时间 def time_set(self, d_now='00:00', d_total='00:00'): if d_now == '00:00': self.time_label.setText('--/--') self.start_pause_btn.setIcon(QIcon('ico/start.png')) else: self.time_label.setText(d_now + '/' + d_total) #获取视频总时长,并设定进度条可用 def get_duration(self, p): self.progress_slider.setRange(0, p) self.vedio_duration_total = self.time_conversion(p) self.progress_slider.setEnabled(True) #更新进度条和时间 def update_position(self, p): self.progress_slider.setValue(p) self.vedio_duration_now = p self.time_set(self.time_conversion(self.vedio_duration_now), self.vedio_duration_total) #移动滑块后更新视频,更新时间显示 def move_position(self, p): self.player.setPosition(p) self.vedio_duration_now = p self.time_set(self.time_conversion(self.vedio_duration_now), self.vedio_duration_total)
def test_icon(pixmap_differ: PixmapDiffer): actual: QPainter expected: QPainter with pixmap_differ.create_painters( 300, 240, 'scaled_radio_button_icon') as (actual, expected): display = TicTacToeDisplay() icon = display.player1_icon display.close() ex_widget = QWidget() ex_layout = QVBoxLayout(ex_widget) ex_radio1 = QRadioButton() ex_radio2 = QRadioButton('Lorem ipsum') ex_radio1.setIcon(icon) ex_radio2.setIcon(icon) ex_font = ex_radio1.font() if ex_font.family() == 'Sans Serif': # Fonts are different on Travis CI. big_font_size = 93 small_font_size = 22 ex_radio1.setStyleSheet('QRadioButton::indicator {width: 93} ' 'QRadioButton {spacing: 46}') ex_radio2.setStyleSheet('QRadioButton::indicator {width: 22} ' 'QRadioButton {spacing: 11}') else: big_font_size = 93 small_font_size = 25 ex_radio1.setStyleSheet('QRadioButton::indicator {width: 93} ' 'QRadioButton {spacing: 46}') ex_radio2.setStyleSheet('QRadioButton::indicator {width: 25} ' 'QRadioButton {spacing: 12}') ex_radio1.setIconSize( QSize(big_font_size * 3 // 2, big_font_size * 3 // 2)) ex_radio2.setIconSize( QSize(small_font_size * 3 // 2, small_font_size * 3 // 2)) ex_font.setPointSize(big_font_size) ex_radio1.setFont(ex_font) ex_font.setPointSize(small_font_size) ex_radio2.setFont(ex_font) ex_size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) ex_radio1.setSizePolicy(ex_size_policy) ex_radio2.setSizePolicy(ex_size_policy) ex_layout.addWidget(ex_radio1) ex_layout.addWidget(ex_radio2) ex_layout.setStretch(0, 4) ex_layout.setStretch(1, 1) ex_widget.resize(300, 240) expected.drawPixmap(0, 0, ex_widget.grab()) widget = QWidget() layout = QVBoxLayout(widget) radio1 = ScaledRadioButton() radio2 = ScaledRadioButton('Lorem ipsum') radio1.setIcon(icon) radio2.setIcon(icon) size_policy = QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) radio1.setSizePolicy(size_policy) radio2.setSizePolicy(size_policy) layout.addWidget(radio1) layout.addWidget(radio2) layout.setStretch(0, 4) layout.setStretch(1, 1) widget.resize(300, 240) actual.drawPixmap(0, 0, widget.grab())
def __init__(self, parent=None): super(TViewerWindow, self).__init__(parent) self.__set_title("") self.resize(600, 600) self._filename = "" # file info self._info = QLabel(self) # status bar self.status = QStatusBar(self) self.status.setSizeGripEnabled(True) self.status.insertPermanentWidget(0, self._info) self.setStatusBar(self.status) # central widget window = QWidget(self) self.setCentralWidget(window) # main layout layout = QVBoxLayout(window) layout.setContentsMargins(0, 0, 0, 0) window.setLayout(layout) layout_2 = QHBoxLayout(self) layout_2.addStretch() layout_2.setSpacing(0) layout_2.addWidget(QLabel(" Channels: ")) button = TRightClickButton("R") button.setStatusTip("Show Red (Right click to toggle solo)") button.setCheckable(True) button.setChecked(True) button.clicked.connect(self.__slot_channels) button.rightClicked.connect(self.__slot_channels_right) self._btn_r = button layout_2.addWidget(button) button = TRightClickButton("G") button.setStatusTip("Show Green (Right click to toggle solo)") button.setCheckable(True) button.setChecked(True) button.clicked.connect(self.__slot_channels) button.rightClicked.connect(self.__slot_channels_right) self._btn_g = button layout_2.addWidget(button) button = TRightClickButton("B") button.setStatusTip("Show Blue (Right click to toggle solo)") button.setCheckable(True) button.setChecked(True) button.clicked.connect(self.__slot_channels) button.rightClicked.connect(self.__slot_channels_right) self._btn_b = button layout_2.addWidget(button) button = TRightClickButton("A") button.setStatusTip("Show Alpha (Right click to toggle solo)") button.setCheckable(True) button.clicked.connect(self.__slot_channels) button.rightClicked.connect(self.__slot_channels_right) self._btn_a = button layout_2.addWidget(button) layout_2.addSpacing(32) layout_2.addWidget(QLabel(" Background: ")) button = QPushButton("Checkerboard") button.setStatusTip("Show checkerboard background") button.clicked.connect(self.__slot_checkerboard) layout_2.addWidget(button) button = QPushButton("Pick Color") button.setStatusTip("Pick solid background color") button.clicked.connect(self.__slot_solid_color) layout_2.addWidget(button) layout_2.addStretch() layout.addLayout(layout_2) # image viewer view = TGLViewport(self) self._viewport = view # view.doubleClicked.connect(self.__slot_action_open) view.setContextMenuPolicy(Qt.DefaultContextMenu) view.setStatusTip("Use context menu or double click to open") layout.addWidget(view) layout.setStretch(1, 1) layout.setSpacing(0)
class Ui_FE14ConversationEditor(QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.player = FE14ConversationPlayer() self.visual_splitter_1 = QFrame() self.visual_splitter_1.setFrameShape(QFrame.HLine) self.visual_splitter_1.setFrameShadow(QFrame.Sunken) self.buttons_layout = QHBoxLayout() self.buttons_layout.setAlignment(QtGui.Qt.AlignCenter) self.save_button = QPushButton(text="Save") self.preview_button = QPushButton("Preview") self.buttons_layout.addWidget(self.save_button) self.buttons_layout.addWidget(self.preview_button) self.visual_splitter_2 = QFrame() self.visual_splitter_2.setFrameShape(QFrame.HLine) self.visual_splitter_2.setFrameShadow(QFrame.Sunken) self.avatar_form = QFormLayout() self.avatar_name_editor = QLineEdit() self.avatar_is_female_check = QCheckBox() self.avatar_form.addRow("Avatar Name", self.avatar_name_editor) self.avatar_form.addRow("Avatar Is Female", self.avatar_is_female_check) self.visual_splitter_3 = QFrame() self.visual_splitter_3.setFrameShape(QFrame.HLine) self.visual_splitter_3.setFrameShadow(QFrame.Sunken) self.conversation_list = QListView() self.left_layout = QVBoxLayout() self.left_layout.addWidget(self.player) self.left_layout.addWidget(self.visual_splitter_1) self.left_layout.addLayout(self.buttons_layout) self.left_layout.addWidget(self.visual_splitter_2) self.left_layout.addLayout(self.avatar_form) self.left_layout.addWidget(self.visual_splitter_3) self.left_layout.addWidget(self.conversation_list) self.left_layout.setStretch(0, 0) self.left_layout.setStretch(1, 0) self.left_layout.setStretch(2, 0) self.left_layout.setStretch(3, 0) self.left_layout.setStretch(4, 0) self.left_layout.setStretch(5, 0) self.left_layout.setStretch(6, 1) self.text_area = QTextEdit() self.main_layout = QHBoxLayout() self.main_layout.addLayout(self.left_layout) self.main_layout.addWidget(self.text_area) self.main_layout.setStretch(0, 0) self.main_layout.setStretch(1, 1) self.central_widget = QWidget() self.central_widget.setLayout(self.main_layout) self.tool_bar = QToolBar() self.addToolBar(self.tool_bar) self.setCentralWidget(self.central_widget) self.status = QStatusBar() self.setStatusBar(self.status) self.resize(900, 500)
def initUI(self): # Master Layout mainlayout = QVBoxLayout() mainlayout.setContentsMargins(0, 0, 0, 0) mainlayout.setMargin(3) mainlayout.setSpacing(0) mainlayout.setStretch(0, 0) # Top Layout (In Out Duration) subLayout = QHBoxLayout() subLayout.setContentsMargins(0, 0, 0, 0) subLayout.setMargin(2) subLayout.setSpacing(5) # Top Layout Controls self.no = QSpinBox() self.no.setMinimum(1) self.no.setMaximum(9999) # < Memory Concerns Lower self.tcIn = QLineEdit() self.tcOut = QLineEdit() self.tcDur = QLineEdit() index_lbl = QLabel("No:") intc_lbl = QLabel("In:") outtc_lbl = QLabel("Out:") durtc_lbl = QLabel("Duration:") # Add to Layout subLayout.addWidget(index_lbl) subLayout.addWidget(self.no) subLayout.addWidget(intc_lbl) subLayout.addWidget(self.tcIn) subLayout.addWidget(outtc_lbl) subLayout.addWidget(self.tcOut) subLayout.addWidget(durtc_lbl) subLayout.addWidget(self.tcDur) # Add to Main mainlayout.addLayout(subLayout) # Add Next Line Controls second_line_layout = QHBoxLayout() font = QFont("Helvetica", 13) self.font_family = QFontComboBox() self.font_family.setMaximumWidth(180) self.font_family.setCurrentFont(font) second_line_layout.addWidget(self.font_family) self.font_family.currentTextChanged.connect(self.set_font) self.font_size = QComboBox() self.font_size.addItems(["9", "10", "11", "12", "13", "14", "18", "24", "36", "48", "64"]) self.font_size.setCurrentText("13") self.font_size.setMaximumWidth(80) self.font_size.currentIndexChanged.connect(self.set_font) second_line_layout.addWidget(self.font_size) bold = QPushButton("B") bold.clicked.connect(self.bold) italic = QPushButton("I") italic.clicked.connect(self.italic) underline = QPushButton("U") underline.clicked.connect(self.underline) second_line_layout.addWidget(bold) second_line_layout.addWidget(italic) second_line_layout.addWidget(underline) # ------------------------------------------ language = QComboBox() language.addItems(["English", "Tamil", "Hindi"]) language.currentIndexChanged.connect(self.setup_language) language.setDisabled(True) # Disabled spellCheck = QPushButton("Spell Check") spellCheck.setDisabled(True) # Disabled autocomplete = QCheckBox("AutoCmp") autocomplete.toggled.connect(self.setup_autocomplete) second_line_layout.addWidget(language) second_line_layout.addWidget(spellCheck) second_line_layout.addWidget(autocomplete) second_line_layout.addStretch(1) mainlayout.addLayout(second_line_layout) # txtSubTitle = QTextEdit() self.subtitle = CompletionTextEdit() # print(self.subtitle.font()) # completer = DictionaryCompleter() # self.subtitle.setCompleter(completer) # self.subtitle.setMaximumHeight(100) mainlayout.addWidget(self.subtitle) # Setup TimeCode LineEdit Controls self.setup_linedt_tc(self.tcIn) self.setup_linedt_tc(self.tcOut) self.setup_linedt_tc(self.tcDur) self.tcOut.editingFinished.connect(self.calculate_duration) # Layout Operations self.setLayout(mainlayout) self.setTabOrder(self.tcDur, self.subtitle) self.show()