def add_build_slider(self): """ adds the new button. :return: <QTWidgets.QPushButton> """ h_layout = QtWidgets.QHBoxLayout() label = QtWidgets.QLabel("Build: ") label.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) # set slider options self.build_slider = QtWidgets.QSlider() self.build_slider.setTickInterval(1) self.build_slider.setMinimum(0) self.build_slider.setMaximum(1) self.build_slider.setSliderPosition(0) self.build_slider.setOrientation(QtCore.Qt.Horizontal) self.build_slider.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum) # slider.setStyleSheet(ui_stylesheets.slider_stylesheet) h_layout.addWidget(label) h_layout.addWidget(self.build_slider) self.connect_slider(self.build_slider) return h_layout
def __init__(self, parent=None, label="Renamer", text=""): super(GetNameWidget, self).__init__(parent) self.result = "" self.line = LineEdit(label="Rename", placeholder_text=text) layout = QtWidgets.QVBoxLayout() layout.addWidget(self.line) button_layout = QtWidgets.QHBoxLayout() # button_group = QtGui.QButtonGroup() layout.addLayout(button_layout) # sets the default button at confirm button = QtWidgets.QPushButton("Confirm") button.setDefault(True) button.setFocus() # adds the cancel button cancel = QtWidgets.QPushButton("Cancel") button.clicked.connect(self.rename_call) cancel.clicked.connect(self.close_ui) button_layout.addWidget(button) button_layout.addWidget(cancel) self.setWindowTitle(label) self.setLayout(layout)
def build(self): """ builds the widget box :return: <QtWidget> """ main_layout = QtWidgets.QHBoxLayout(self) self.widgets["labelWidget"] = QtWidgets.QLabel(self.label) self.widgets["lineEdit"] = QtWidgets.QLineEdit() self.widgets["lineEdit"].setPlaceholderText(self.placeholder_text) main_layout.addWidget(self.widgets["labelWidget"]) main_layout.addWidget(self.widgets["lineEdit"]) self.setLayout(main_layout) return self.widgets
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) # add the widgets to the layouts. self.main_widget = QtWidgets.QWidget(self) self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.main_layout = QtWidgets.QHBoxLayout(self) self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True) # add the two widgets to the main layout horizontal_split = QtWidgets.QSplitter(QtCore.Qt.Horizontal) self.main_layout.addWidget(horizontal_split) self.module_form = ModuleForm(parent=self) self.information_form = InformationForm(parent=self) horizontal_split.addWidget(self.module_form) horizontal_split.addWidget(self.information_form) # set up the right click menu box self.module_form.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.add_menu_actions(self.module_form) # add a menu bar self.menu_bar_data = self.setup_menu_bar() # resize the main window self.setMinimumSize(self.HEIGHT, self.WIDTH) # connect triggers self.connect_menu_options() self.connect_blueprint_options() self.connect_utilities_options() # add main layout self.main_widget.setLayout(self.main_layout) self.setCentralWidget(self.main_widget) self.setWindowTitle(title) self.setStyleSheet(ui_stylesheets.dark_orange_stylesheet) self.setObjectName(object_name)
def __init__(self, parent=None): super(ModuleForm, self).__init__(parent) self.resize(200, 400) self.parent = parent # set the toggle back at default self.build = 0 self.vertical_layout = QtWidgets.QVBoxLayout(self) self.combo_layout = QtWidgets.QHBoxLayout() self.creature_combo = QtWidgets.QComboBox(self) self.fill_blueprints() self.creature_label = QtWidgets.QLabel("Select Blueprint: ") self.combo_layout.addWidget(self.creature_label) self.combo_layout.addWidget(self.creature_combo) self.vertical_layout.addLayout(self.combo_layout) self.list = self.add_module_list() slider_layout = self.add_build_slider() # connect buttons # self.button.clicked.connect(self.finish_all_call) self.vertical_layout.addLayout(slider_layout) self.vertical_layout.addWidget(self.list) self.setLayout(self.vertical_layout) self.setMinimumWidth(self.parent.WIDTH / 2) # connect the widget self.list.itemClicked.connect(parent.select_item) # connect the combo changer self.creature_combo.currentIndexChanged.connect( self.creature_selected_call)
def __init__(self, parent=None, list_items=()): super(ModulesList, self).__init__(parent) self.selected_item = None self.list_items = list_items vertical_layout = QtWidgets.QVBoxLayout() self.list_widget = QtWidgets.QListWidget() vertical_layout.addWidget(self.list_widget) horizontal_layout = QtWidgets.QHBoxLayout() self.ok_button = QtWidgets.QPushButton("Ok") self.cancel_button = QtWidgets.QPushButton("Cancel") horizontal_layout.addWidget(self.ok_button) horizontal_layout.addWidget(self.cancel_button) vertical_layout.addLayout(horizontal_layout) self.list_widget.addItems(self.list_items) self.create_connections() self.setLayout(vertical_layout) self.setWindowTitle("Modules List")
def __init__(self, parent=None, module_name="", list_widget=None, item=None, information=None): super(ModuleWidget, self).__init__(parent) # initialize the module main layout self.main_layout = QtWidgets.QHBoxLayout() self.main_layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) self.setLayout(self.main_layout) # initialize widget variables self.icon = None self.q_text = None self.q_pix = None self.build_button = None self.delete_button = None self.version_combo = None self.name_label = None self.dialog = None self.module = None # initialize important variables self.list_widget = list_widget self.item = item self.parent = parent self.version = 0000 self.module_name = module_name self.module_data = self.find_module_data(module_name) self.module_index = get_module_count(module_name) # set the information data dictionary of the module to pass data down to modules if information: if "name" in information: self.name = information["name"] if "creature" not in information: information[ "creature"] = parent.module_form.get_selected_blueprint() if "creature_directory" not in information: information["creature_directory"] = blueprint_utils.build_dir( information["creature"]) else: self.name = '{}_{}'.format(module_name, self.module_index) # debug print debug_print("{}\n".format(self.name)) debug_print(information) # build the module widgets self.build() self.initialize_versions() # create the connections self.connect_buttons() # activate this module self.create_module(information=information) debug_print(self.module.PUBLISH_ATTRIBUTES) # initialize the attributes # Python never implicitly copies the objects, when set, it is referred to the exact same module. self.module_attributes = dict(self.module.PUBLISH_ATTRIBUTES) # update the class published attribute with the name given self.update_attribute('name', self.name)