def radio_ButtonGroup(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) window.setWindowTitle('Radio button test') layout = QVBoxLayout(window) button_01 = QRadioButton('apple') button_02 = QRadioButton('orange') button_03 = QRadioButton('coffee') button_04 = QRadioButton('tea') fruit_grp = QButtonGroup() fruit_grp.addButton(button_02) fruit_grp.addButton(button_01) drink_grp = QButtonGroup() drink_grp.addButton(button_02) drink_grp.addButton(button_01) layout.addWidget(button_01) layout.addWidget(button_02) layout.addWidget(button_03) layout.addWidget(button_04) window.setLayout(layout) window.show()
def UI(): main_window = get_main_window() window = QWidget(parent=main_window, f=QtCore.Qt.Window) window.setWindowTitle('Append text to file tool') layout = QVBoxLayout(window) # set line edit path_widget = QLineEdit() path_widget.setPlaceholderText('path...') # set button button = QPushButton('Rewrite file') button.clicked.connect(lambda: button_command(path_widget, result_widget)) # set textedit result_widget = QTextEdit() result_widget.setPlaceholderText('write something...') # set Label hint = QLabel('Info , user and time info will append to the file.') # set layout layout.addWidget(hint) layout.addWidget(path_widget) layout.addWidget(result_widget) layout.addWidget(button) window.show()
def radio_GroupBox(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) layout = QHBoxLayout(window) fruit_widgets = QGroupBox('Fruit') # fruit_widget = QtWidgets.QWidget() fruit_layout = QVBoxLayout(fruit_widgets) # fruit_label = QtWidgets.QLabel('Fruit') btn_01 = QRadioButton('apple') btn_02 = QRadioButton('orange') # fruit_layout.addWidget(fruit_label) fruit_layout.addWidget(btn_01) fruit_layout.addWidget(btn_02) drink_widgets = QGroupBox('Drink') # drink_widget = QtWidgets.QWidget() drink_layout = QVBoxLayout(drink_widgets) # drink_label = QtWidgets.QLabel('Drink') btn_03 = QRadioButton('tea') btn_04 = QRadioButton('coffee') # drink_layout.addWidget(drink_label) drink_layout.addWidget(btn_03) drink_layout.addWidget(btn_04) layout.addWidget(fruit_widgets) layout.addWidget(drink_widgets) window.show()
def UI(): main_window = get_main_window() window = QWidget(parent=main_window, f=QtCore.Qt.Window) window.setWindowTitle('CheckBox test') layout = QVBoxLayout(window) check_box_all = QCheckBox('All') check_box_list = [] for item in ['Apple', 'Orange']: check_box_item = QCheckBox(item) check_box_list.append(check_box_item) check_box_item.clicked.connect( partial(button_alone, check_box_all, check_box_list)) check_box_all.clicked.connect( partial(all_button, check_box_all, check_box_list)) result = QTextEdit() # set button button = QPushButton('enter') button.clicked.connect(partial(button_command, check_box_list, result)) layout.addWidget(check_box_all) for item in check_box_list: layout.addWidget(item) layout.addWidget(button) layout.addWidget(result) window.setLayout(layout) window.show()
def scroll_UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) layout = QVBoxLayout(window) button_list_widget = QWidget() button_list_layout = QVBoxLayout(button_list_widget) with open('D:/Documents/work/TWR/TD class/file_format/example.json', 'r') as read_obj: content = read_obj.read() data = json.loads(content) for item in data: name = item['name'] button_name = name button_widget = QPushButton(button_name) button_list_layout.addWidget(button_widget) scroll_widget = QScrollArea() scroll_widget.setWidget(button_list_widget) scroll_widget.setWidgetResizable(True) layout.addWidget(scroll_widget) window.show()
def UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) window.setWindowTitle('Write file tool (advanced)') layout = QVBoxLayout(window) file_info_widget = QGroupBox('File info') file_info_layout = QVBoxLayout(file_info_widget) hint_label = QLabel( 'input path to check if exist then write content to a file.') path_widget = QLineEdit() path_widget.setPlaceholderText('path...') # set button button = QPushButton('write a file') button.clicked.connect(lambda: button_command(path_widget, result_widget)) # set textedit result_widget = QTextEdit() result_widget.setPlaceholderText('write something...') # set layout file_info_layout.addWidget(hint_label) file_info_layout.addWidget(path_widget) file_info_layout.addWidget(result_widget) file_info_layout.addWidget(button) layout.addWidget(file_info_widget) window.show()
def enable_UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) layout = QVBoxLayout(window) tab_widget = QTabWidget() ani_button_list_widget = QWidget() ani_button_list_layout = QVBoxLayout(ani_button_list_widget) fx_button_list_widget = QWidget() fx_button_list_layout = QVBoxLayout(fx_button_list_widget) with open('D:/Documents/work/TWR/TD class/file_format/random.json', 'r') as read_obj: content = read_obj.read() data = json.loads(content) for item in data: name = item['name'] button_name = name button_widget = QPushButton(button_name) if item['type'] == 'animation': ani_button_list_layout.addWidget(button_widget) if item['type'] == 'fx': fx_button_list_layout.addWidget(button_widget) if item['enable'] == 'True': button_widget.setEnabled(True) if item['enable'] == 'False': button_widget.setEnabled(False) ani_scroll_widget = QScrollArea() fx_scroll_widget = QScrollArea() ani_scroll_widget.setWidget(ani_button_list_widget) fx_scroll_widget.setWidget(fx_button_list_widget) ani_scroll_widget.setWidgetResizable(True) fx_scroll_widget.setWidgetResizable(True) tab_widget.addTab(ani_scroll_widget, 'ani') tab_widget.addTab(fx_scroll_widget, 'fx') layout.addWidget(tab_widget) window.show()
def UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(Qt.Window) window.setWindowTitle('Make shot info file tool') layout = QVBoxLayout(window) project_widget = QGroupBox('File info') project_layout = QHBoxLayout(project_widget) proj = QComboBox() for item in proj_title_list: proj.addItem(item) proj.activated.connect(lambda: read_dict(proj, shot_info_list)) project_layout.addWidget(proj) shot_info_list = [] for item in shot_title_list: shot_info = QLineEdit() shot_info.setPlaceholderText(item) shot_info_list.append(shot_info) project_layout.addWidget(shot_info) ini_button = QPushButton('Create INI file') csv_button = QPushButton('Create CSV file') json_button = QPushButton('Create JSON file') xml_button = QPushButton('Create XML file') ini_button.clicked.connect( lambda: ini_button_command(proj, shot_info_list)) csv_button.clicked.connect( lambda: csv_button_command(proj, shot_info_list)) json_button.clicked.connect( lambda: json_button_command(proj, shot_info_list)) xml_button.clicked.connect( lambda: xml_button_command(proj, shot_info_list)) layout.addWidget(project_widget) layout.addWidget(ini_button) layout.addWidget(csv_button) layout.addWidget(json_button) layout.addWidget(xml_button) window.show()
def UI(): # main window main_window = main_window_houdini.get_main_window() window = QWidget(parent=main_window, f=Qt.Window) window.setWindowTitle('Rename object tool') main_layout = QVBoxLayout(window) # widget obj_name = QLineEdit() obj_name.setPlaceholderText('set new name...') button = QPushButton('Raname') button.clicked.connect(lambda: button_command(obj_name)) main_layout.addWidget(obj_name) main_layout.addWidget(button) window.show()
def UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) window.setWindowTitle('Choose fruit & drink tool') layout = QVBoxLayout(window) mini_widget = QWidget() mini_layout = QHBoxLayout(mini_widget) fruit_widgets = QGroupBox('Fruit') fruit_layout = QVBoxLayout(fruit_widgets) btn_01 = QRadioButton('apple') btn_02 = QRadioButton('orange') fruit_layout.addWidget(btn_01) fruit_layout.addWidget(btn_02) drink_widgets = QGroupBox('Drink') drink_layout = QVBoxLayout(drink_widgets) btn_03 = QRadioButton('tea') btn_04 = QRadioButton('coffee') drink_layout.addWidget(btn_03) drink_layout.addWidget(btn_04) fruit_btn_list = [btn_01, btn_02] drink_btn_list = [btn_03, btn_04] edit_widget = QTextEdit() button = QPushButton('Get resault dictionary') button.clicked.connect( partial(button_command, fruit_btn_list, drink_btn_list, edit_widget)) layout.addWidget(mini_widget) mini_layout.addWidget(fruit_widgets) mini_layout.addWidget(drink_widgets) layout.addWidget(button) layout.addWidget(edit_widget) window.show()
def checkbox_UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) layout = QVBoxLayout(window) check_box_widget = QWidget() ani_check = QCheckBox('animation') fx_check = QCheckBox('fx') ani_check.clicked.connect(lambda: checkbox_command(ani_check, button_list)) fx_check.clicked.connect(lambda: checkbox_command(fx_check, button_list)) check_box_layout = QHBoxLayout(check_box_widget) check_box_layout.addWidget(ani_check) check_box_layout.addWidget(fx_check) button_list_widget = QWidget() button_list_layout = QVBoxLayout(button_list_widget) button_list = [] with open('D:/Documents/work/TWR/TD class/file_format/random.json', 'r') as read_obj: content = read_obj.read() data = json.loads(content) for item in data: name = item['name'] button_name = name button_widget = QPushButton(button_name) button_list_layout.addWidget(button_widget) button_list.append(button_widget) scroll_widget = QScrollArea() scroll_widget.setWidget(button_list_widget) scroll_widget.setWidgetResizable(True) layout.addWidget(check_box_widget) layout.addWidget(scroll_widget) window.show()
def UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) # give main_window to be parent window.setWindowFlags(QtCore.Qt.Window) #open tool as new window window.setWindowTitle('Get missing file and file list tool') layout = QVBoxLayout(window) path = QGroupBox('Path info') path_layout = QVBoxLayout(path) file_path = QLineEdit() file_path.setPlaceholderText('path…') #set combobox combo_box = QComboBox() for ext_name in ['png', 'exr', 'jpg']: combo_box.addItem(ext_name) #default combobox set combo_box.setCurrentIndex(1) #set button button = QPushButton('Get missing file / file list') button.clicked.connect(lambda: button_command(file_path, combo_box, text_edit)) text_edit = QTextEdit() #set layout path_layout.addWidget(file_path) path_layout.addWidget(combo_box) path_layout.addWidget(button) layout.addWidget(path) layout.addWidget(text_edit) window.show()
def UI(): main_window = get_main_window() window = QWidget() window.setParent(main_window) window.setWindowFlags(QtCore.Qt.Window) window.setWindowTitle('Get sequence/shot test') layout = QHBoxLayout(window) # set combobox seq_combo_box = QComboBox() seq_list = os.listdir('D://twr') for seq in seq_list: seq_combo_box.addItem(seq) #shot_list = os.listdir('Z://twr//' + str(seq)) #print(shot_list) shot_combo_box = QComboBox() for shot in os.listdir('D://twr//' + seq_combo_box.currentText()): shot_combo_box.addItem(shot) seq_combo_box.activated.connect( lambda: combo_command(seq_combo_box, shot_combo_box)) #set button button = QPushButton('Get') button.clicked.connect( lambda: button_command(seq_combo_box, shot_combo_box)) #set layout layout.addWidget(seq_combo_box) layout.addWidget(shot_combo_box) layout.addWidget(button) window.setLayout(layout) window.show()
def UI(): main_window = get_main_window() window = QWidget(parent=main_window, f=QtCore.Qt.Window) window.setWindowTitle('Check task') layout = QVBoxLayout(window) task_info = QGroupBox('Task info') task_layout = QVBoxLayout(task_info) check_box_list = [] for item in ['animation', 'lighting', 'fx', 'comp']: check_box_item = QCheckBox(item) check_box_list.append(check_box_item) check_box_all = QCheckBox('All') check_box_all.clicked.connect( partial(all_button, check_box_all, check_box_list)) for item in check_box_list: item.clicked.connect( partial(button_alone, check_box_all, check_box_list)) edit_widget = QTextEdit() button = QPushButton('enter') button.clicked.connect(partial(button_command, check_box_list, edit_widget)) task_layout.addWidget(check_box_all) for item in check_box_list: task_layout.addWidget(item) task_layout.addWidget(button) layout.addWidget(task_info) layout.addWidget(edit_widget) window.show()