def _setup_signals(self): """create the signals """ # name_line_edit is changed QtCore.QObject.connect( self.name_line_edit, QtCore.SIGNAL('textChanged(QString)'), self.name_line_edit_changed ) # add context menu for primary items in DoubleListWidget self.filename_templates_double_list_widget\ .primary_list_widget\ .setContextMenuPolicy(QtCore.Qt.CustomContextMenu) QtCore.QObject.connect( self.filename_templates_double_list_widget.primary_list_widget, QtCore.SIGNAL("customContextMenuRequested(const QPoint&)"), self.show_primary_filename_template_context_menu ) # add context menu for secondary items in DoubleListWidget self.filename_templates_double_list_widget\ .secondary_list_widget\ .setContextMenuPolicy(QtCore.Qt.CustomContextMenu) QtCore.QObject.connect( self.filename_templates_double_list_widget.secondary_list_widget, QtCore.SIGNAL("customContextMenuRequested(const QPoint&)"), self.show_secondary_filename_template_context_menu )
def setup_signals(self): """connects the signals to slots """ # fit column 0 on expand/collapse QtCore.QObject.connect( self, QtCore.SIGNAL('expanded(QModelIndex)'), self.auto_fit_column ) QtCore.QObject.connect( self, QtCore.SIGNAL('collapsed(QModelIndex)'), self.auto_fit_column ) # custom context menu for the tasks_treeView self.setContextMenuPolicy( QtCore.Qt.CustomContextMenu ) QtCore.QObject.connect( self, QtCore.SIGNAL("customContextMenuRequested(const QPoint&)"), self.show_context_menu )
def _setup_ui(self): """create the UI elements """ # Create the main layout self.resize(850, 650) # Main Layout self.main_layout = QtWidgets.QVBoxLayout(self) # Dialog Label self.dialog_label = QtWidgets.QLabel(self) self.dialog_label.setText("Clip Manager") self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);font: 18pt;") self.main_layout.addWidget(self.dialog_label) # Title Line line = QtWidgets.QFrame(self) line.setFrameShape(QtWidgets.QFrame.HLine) line.setFrameShadow(QtWidgets.QFrame.Sunken) self.main_layout.addWidget(line) # Add Clip Field Button self.add_clip_field_push_button = QtWidgets.QPushButton(self) self.add_clip_field_push_button.setText("Add Clip") self.main_layout.addWidget(self.add_clip_field_push_button) # Clip Fields Layout self.scroll_area_widget = QtWidgets.QWidget(self) self.clip_vertical_layout = QtWidgets.QVBoxLayout(self) self.scroll_area_widget.setLayout(self.clip_vertical_layout) self.scroll_area = QtWidgets.QScrollArea(self) self.scroll_area.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarAsNeeded) self.scroll_area.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAsNeeded) self.scroll_area.setWidgetResizable(True) self.scroll_area.setWidget(self.scroll_area_widget) self.main_layout.addWidget(self.scroll_area) # Create Shots Push Button self.create_shots_push_button = QtWidgets.QPushButton(self) self.create_shots_push_button.setText("Create") self.main_layout.addWidget(self.create_shots_push_button) # setup signals # Add Clip Push Button QtCore.QObject.connect(self.add_clip_field_push_button, QtCore.SIGNAL("clicked()"), self.add_clip_field) # Create Push Button QtCore.QObject.connect(self.create_shots_push_button, QtCore.SIGNAL("clicked()"), self.create_shots)
def _setup_signals(self): """setup ui signals """ QtCore.QObject.connect(self.projects_combo_box, QtCore.SIGNAL("currentIndexChanged(QString)"), self.project_changed) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.button_box, QtCore.SIGNAL("rejected()"), self.reject)
def setup_signals(self): """setting up signals """ QtCore.QObject.connect(self.media_files_path_lineEdit, QtCore.SIGNAL('textChanged(QString)'), self.store_media_file_path) QtCore.QObject.connect(self.edl_path_lineEdit, QtCore.SIGNAL('textChanged(QString)'), self.open_edl) QtCore.QObject.connect(self.send_pushButton, QtCore.SIGNAL('clicked()'), self.send)
def _setup_signals(self): """creates the signals between ui elements """ # create_image_format_pushButton QtCore.QObject.connect(self.create_push_button, QtCore.SIGNAL('clicked()'), self.create_push_button_clicked) # update_image_format_pushButton QtCore.QObject.connect(self.update_push_button, QtCore.SIGNAL('clicked()'), self.update_push_button_clicked)
def _setup_ui(self): self.resize(629, 567) self.verticalLayout = QtWidgets.QVBoxLayout(self) self.buttonBox = QtWidgets.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) QtCore.QMetaObject.connectSlotsByName(self)
def _setup_signals(self): """sets up the signals """ logger.debug("start setting up interface signals") # cancel button QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL('rejected()'), self.close) # Ok button QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL('accepted()'), self.login) logger.debug("finished setting up interface signals")
def _setup_dialog(self): """create the UI elements """ # set window title self.setWindowTitle("Duplicate Task Hierarchy") # set window size self.resize(285, 118) # create the main layout self.main_layout = QtWidgets.QVBoxLayout(self) self.setLayout(self.main_layout) # the label self.label = QtWidgets.QLabel(self) self.label.setText('Duplicated Task Name:') self.main_layout.addWidget(self.label) # the line edit self.line_edit = QtWidgets.QLineEdit(self) self.line_edit.setText(self.duplicated_task_name) self.main_layout.addWidget(self.line_edit) # the check box self.check_box = QtWidgets.QCheckBox(self) self.check_box.setText('Keep resources') self.check_box.setChecked(True) self.main_layout.addWidget(self.check_box) # the button box self.button_box = QtWidgets.QDialogButtonBox(self) self.button_box.setOrientation(QtCore.Qt.Horizontal) self.button_box.setStandardButtons( QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok ) self.main_layout.addWidget(self.button_box) # setup signals QtCore.QObject.connect( self.button_box, QtCore.SIGNAL("accepted()"), self.accept ) QtCore.QObject.connect( self.button_box, QtCore.SIGNAL("rejected()"), self.reject )
def _setup_signals(self): """setup signals """ # Filter By Project ComboBox QtCore.QObject.connect(self.filter_by_project_combo_box, QtCore.SIGNAL('currentIndexChanged(QString)'), self.filter_by_project_combo_box_changed) QtCore.QObject.connect(self.filter_by_entity_type_combo_box, QtCore.SIGNAL('currentIndexChanged(QString)'), self.filter_by_entity_type_combo_box_changed) QtCore.QObject.connect(self.filter_push_button, QtCore.SIGNAL('clicked()'), self.filter_push_button_clicked)
def create_main_menu(self): """creates the main application menu """ file_menu = self.menuBar().addMenu(self.tr("&File")) # ------------------------- # Authentication Actions self.login_action = file_menu.addAction("&Login...") self.logout_action = file_menu.addAction("&Logout...") if self.logged_in_user: # hide login_action self.login_action.setVisible(False) else: # hide logout_action self.login_action.setVisible(False) QtCore.QObject.connect(self.login_action, QtCore.SIGNAL('triggered()'), self.login) QtCore.QObject.connect(self.logout_action, QtCore.SIGNAL('triggered()'), self.logout) file_menu.addSeparator() # --------------------------- # Standard File menu actions create_project_action = file_menu.addAction('&Create Project...') # open_action = file_menu.addAction('&Open...') # save_action = file_menu.addAction('&Save...') # run the new Project dialog QtCore.QObject.connect(create_project_action, QtCore.SIGNAL("triggered()"), self.create_project_action_clicked) file_menu.addSeparator() exit_action = file_menu.addAction('E&xit') QtCore.QObject.connect(exit_action, QtCore.SIGNAL('triggered()'), self.close) view_menu = self.menuBar().addMenu(self.tr("&View")) reset_action = view_menu.addAction("&Reset Window States") QtCore.QObject.connect(reset_action, QtCore.SIGNAL('triggered()'), self.reset_window_state)
def ui_caller(app_in, executor, ui_class, **kwargs): global app global ui_instance self_quit = False app = QtWidgets.QApplication.instance() if app is None: if not app_in: try: app = QtWidgets.QApplication(sys.argv) except AttributeError: # sys.argv gives argv.error app = QtWidgets.QApplication([]) else: app = app_in self_quit = True ui_instance = ui_class(**kwargs) ui_instance.show() if executor is None: app.exec_() if self_quit: app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) else: executor.exec_(app, ui_instance) return ui_instance
def _setup_signals(self): """create the signals """ # name_line_edit is changed QtCore.QObject.connect(self.name_line_edit, QtCore.SIGNAL('textChanged(QString)'), self.name_line_edit_changed)
def add_button(label, layout, callback, tooltip='', callback_kwargs=None): """A wrapper for button creation :param label: The label of the button :param layout: The layout that the button is going to be placed under. :param callback: The callable that will be called when the button is clicked. :param str tooltip: Optional tooltip for the button :param callback_kwargs: Callback arguments :return: """ if tooltip == '': tooltip = callback.__doc__ # button button = QtWidgets.QPushButton(layout.parentWidget()) button.setText(label) layout.addWidget(button) button.setToolTip(tooltip) # Signal if callback_kwargs: import functools callback = functools.partial(callback, **callback_kwargs) QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), callback) return button
def add_button(label, layout, callback, tooltip=''): """A wrapper for button creation :param label: The label of the button :param layout: The layout that the button is going to be placed under. :param callback: The callable that will be called when the button is clicked. :param str tooltip: Optional tooltip for the button :return: """ # button button = QtWidgets.QPushButton() button.setText(label) layout.addWidget(button) button.setToolTip(tooltip) # Signal QtCore.QObject.connect( button, QtCore.SIGNAL("clicked()"), callback ) return button
def create_dock_widgets(self): """creates the dock widgets """ # ---------------------------------------- # create the Project Dock Widget self.project_dock_widget = QtWidgets.QDockWidget('Projects', self) self.project_dock_widget.setObjectName('project_dock_widget') # create the TaskTreeView as the main widget from anima.ui.views.task import TaskTreeView self.tasks_tree_view = TaskTreeView(parent=self) self.tasks_tree_view.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.tasks_tree_view.show_completed_projects = True self.tasks_tree_view.fill() # also setup the signal QtCore.QObject.connect( self.tasks_tree_view.selectionModel(), QtCore.SIGNAL('selectionChanged(const QItemSelection &, ' 'const QItemSelection &)'), self.tasks_tree_view_changed) self.project_dock_widget.setWidget(self.tasks_tree_view) # and set the left dock widget self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.project_dock_widget) # ---------------------------------------- # create the Central Widget from anima.ui.widgets.task_dashboard import TaskDashboardWidget self.task_dashboard_widget = TaskDashboardWidget(parent=self) self.setCentralWidget(self.task_dashboard_widget)
def _fill_ui(self): """fills the ui with default values """ # just import the anima.publish module # if the environment is setup properly # the publish.publishers should have been filled with publishers from anima import publish publish.staging['version'] = self.version # generate generics first ppt = publish.PRE_PUBLISHER_TYPE # check if the environment has at least a couple of publishers if '' in publish.publishers[ppt]: for publisher in publish.publishers[ppt]['']: self.publishers.append(self.create_publisher_field(publisher)) # get the current type if self.environment: # version = self.environment.get_current_version() if self.version and self.version.task.type: type_name = self.version.task.type.name.lower() # generate generics first if type_name in publish.publishers[ppt]: for publisher in publish.publishers[ppt][type_name]: self.publishers.append( self.create_publisher_field(publisher)) # for all publishers also connect the clicked signal of their check # buttons to enable or disable the publish button for publisher in self.publishers: QtCore.QObject.connect(publisher.check_push_button, QtCore.SIGNAL('clicked()'), self.check_publisher_states)
def ui_caller(app_in, executor, DialogClass, **kwargs): global app global mainDialog self_quit = False if QtGui.QApplication.instance() is None: if not app_in: try: app = QtGui.QApplication(sys.argv) except AttributeError: # sys.argv gives argv.error app = QtGui.QApplication([]) else: app = app_in self_quit = True else: app = QtGui.QApplication.instance() mainDialog = DialogClass(**kwargs) mainDialog.show() if executor is None: app.exec_() if self_quit: app.connect(app, QtCore.SIGNAL("lastWindowClosed()"), app, QtCore.SLOT("quit()")) else: executor.exec_(app, mainDialog) return mainDialog
def setup_ui(self): """create the UI widgets """ self.vertical_layout = QtWidgets.QVBoxLayout(self) self.setLayout(self.vertical_layout) # the widget should consist of a QGraphic self.thumbnail_graphics_view = QtWidgets.QGraphicsView(self) # set size policy size_policy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) size_policy.setHorizontalStretch(0) size_policy.setVerticalStretch(0) size_policy.setHeightForWidth( self.thumbnail_graphics_view.sizePolicy().hasHeightForWidth()) self.thumbnail_graphics_view.setSizePolicy(size_policy) # set size default_size = QtCore.QSize(*self.default_thumbnail_size) self.thumbnail_graphics_view.setMinimumSize(default_size) self.thumbnail_graphics_view.setMaximumSize(default_size) self.thumbnail_graphics_view.setAutoFillBackground(False) self.thumbnail_graphics_view.setVerticalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.thumbnail_graphics_view.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) brush = QtGui.QBrush(QtGui.QColor(0, 0, 0)) brush.setStyle(QtCore.Qt.SolidPattern) self.thumbnail_graphics_view.setBackgroundBrush(brush) self.thumbnail_graphics_view.setInteractive(False) self.thumbnail_graphics_view.setRenderHints( QtGui.QPainter.Antialiasing | QtGui.QPainter.HighQualityAntialiasing | QtGui.QPainter.SmoothPixmapTransform | QtGui.QPainter.TextAntialiasing) self.vertical_layout.addWidget(self.thumbnail_graphics_view) self.upload_thumbnail_button = QtWidgets.QPushButton(self) self.upload_thumbnail_button.setText("Upload...") self.upload_thumbnail_button.setGeometry( self.thumbnail_graphics_view.geometry()) self.upload_thumbnail_button.setVisible(True) self.vertical_layout.addWidget(self.upload_thumbnail_button) # create signals # QtCore.QObject.connect( # self.thumbnail_graphics_view, # QtCore.SIGNAL("clicked()"), # self.thumbnail_graphics_view_clicked # ) QtCore.QObject.connect(self.upload_thumbnail_button, QtCore.SIGNAL("clicked()"), self.upload_thumbnail_button_clicked)
def _setup_signals(self): """sets up the signals """ logger.debug("start setting up interface signals") # Dialog buttons QtCore.QObject.connect(self.dialog_button_box, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.dialog_button_box, QtCore.SIGNAL("rejected()"), self.reject) # tasks_combo_box QtCore.QObject.connect(self.tasks_combo_box, QtCore.SIGNAL('currentIndexChanged(QString)'), self.tasks_combo_box_index_changed) # start_time_edit QtCore.QObject.connect(self.start_time_edit, QtCore.SIGNAL('timeChanged(QTime)'), self.start_time_changed) # end_time_edit QtCore.QObject.connect(self.end_time_edit, QtCore.SIGNAL('timeChanged(QTime)'), self.end_time_changed) # resource changed QtCore.QObject.connect(self.resource_combo_box, QtCore.SIGNAL('currentIndexChanged(QString)'), self.resource_changed) # calendar day selected QtCore.QObject.connect(self.calendar_widget, QtCore.SIGNAL("selectionChanged()"), self.calendar_widget_selection_changed)
def _setup(self): """create UI elements """ self.setWindowTitle("Create Shot Dialog") self.resize(550, 790) self.vertical_layout = QtWidgets.QVBoxLayout(self) # ---------------------------------------------- # Dilog Label self.dialog_label = QtWidgets.QLabel(self) self.dialog_label.setText('Create Shot') self.dialog_label.setStyleSheet("color: rgb(71, 143, 202);font: 18pt;") self.vertical_layout.addWidget(self.dialog_label) # ---------------------------------------------- # Title Line line = QtWidgets.QFrame(self) line.setFrameShape(QtWidgets.QFrame.HLine) line.setFrameShadow(QtWidgets.QFrame.Sunken) self.vertical_layout.addWidget(line) # ---------------------------------------------- # Button Box self.buttonBox = QtWidgets.QDialogButtonBox(self) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons( QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok ) self.vertical_layout.addWidget(self.buttonBox) # ---------------------------------------------- # SIGNALS # button box QtCore.QObject.connect( self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept ) QtCore.QObject.connect( self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject )
def create_toolbars(self): """creates the toolbars """ file_toolbar = self.addToolBar(self.tr("File")) file_toolbar.setObjectName('file_toolbar') create_project_action = file_toolbar.addAction('Create Project') # Create signals QtCore.QObject.connect(create_project_action, QtCore.SIGNAL('triggered()'), self.create_project_action_clicked)
def setup_signals(self): """connects the signals to slots """ # fit column 0 on expand/collapse QtCore.QObject.connect(self, QtCore.SIGNAL('expanded(QModelIndex)'), self.expand_all_selected) QtCore.QObject.connect(self, QtCore.SIGNAL('collapsed(QModelIndex)'), self.collapse_all_selected) # custom context menu for the tasks_treeView self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) QtCore.QObject.connect( self, QtCore.SIGNAL("customContextMenuRequested(const QPoint&)"), self.show_context_menu) QtCore.QObject.connect( self, QtCore.SIGNAL("doubleClicked(const QModelIndex&)"), self.double_clicked_on_entity)
def _setup_signals(self): """sets up the signals """ logger.debug("start setting up interface signals") # tasks_comboBox QtCore.QObject.connect(self.tasks_comboBox, QtCore.SIGNAL('currentIndexChanged(QString)'), self.tasks_combo_box_index_changed) # start_timeEdit QtCore.QObject.connect(self.start_timeEdit, QtCore.SIGNAL('timeChanged(QTime)'), self.start_time_changed) # end_timeEdit QtCore.QObject.connect(self.end_timeEdit, QtCore.SIGNAL('timeChanged(QTime)'), self.end_time_changed) # resource changed QtCore.QObject.connect(self.resource_comboBox, QtCore.SIGNAL('currentIndexChanged(QString)'), self.resource_changed)
def __init__(self, parent=None, project=None): super(MainDialog, self).__init__(parent) self._setup_ui() # create the custom task tree view from anima.ui.views.task import TaskTreeView self.tasks_treeView = TaskTreeView(project=project) self.tasks_treeView.replace_with_other(self.verticalLayout, 0) self.tasks_treeView.fill() # setup the double click signal QtCore.QObject.connect(self.tasks_treeView, QtCore.SIGNAL('doubleClicked(QModelIndex)'), self.tasks_tree_view_double_clicked)
def _setup_signals(self): """creates the signals """ # name_lineEdit is changed QtCore.QObject.connect(self.name_lineEdit, QtCore.SIGNAL('textChanged(QString)'), self.name_line_edit_changed) # code_lineEdit is changed QtCore.QObject.connect(self.code_lineEdit, QtCore.SIGNAL('textChanged(QString)'), self.code_line_edit_changed) # create_image_format_pushButton QtCore.QObject.connect(self.create_image_format_pushButton, QtCore.SIGNAL('clicked()'), self.create_image_format_push_button_clicked) # update_image_format_pushButton QtCore.QObject.connect(self.update_image_format_pushButton, QtCore.SIGNAL('clicked()'), self.update_image_format_push_button_clicked) # create_repository_pushButton QtCore.QObject.connect(self.create_repository_pushButton, QtCore.SIGNAL('clicked()'), self.create_repository_push_button_clicked) # update_repository_pushButton QtCore.QObject.connect(self.update_repository_pushButton, QtCore.SIGNAL('clicked()'), self.update_repository_push_button_clicked) # create_structure_pushButton QtCore.QObject.connect(self.create_structure_pushButton, QtCore.SIGNAL('clicked()'), self.create_structure_push_button_clicked) # update_structure_pushButton QtCore.QObject.connect(self.update_structure_pushButton, QtCore.SIGNAL('clicked()'), self.update_structure_push_button_clicked)
def _setup_signals(self): """creates the signals """ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), self.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject) # name_lineEdit is changed QtCore.QObject.connect(self.name_lineEdit, QtCore.SIGNAL('textChanged(QString)'), self.name_line_edit_changed) # code_lineEdit is changed QtCore.QObject.connect(self.code_lineEdit, QtCore.SIGNAL('textChanged(QString)'), self.code_line_edit_changed) # create_repository_pushButton QtCore.QObject.connect(self.create_repository_pushButton, QtCore.SIGNAL('clicked()'), self.create_repository_push_button_clicked) # update_repository_pushButton QtCore.QObject.connect(self.update_repository_pushButton, QtCore.SIGNAL('clicked()'), self.update_repository_push_button_clicked) # create_structure_pushButton QtCore.QObject.connect(self.create_structure_pushButton, QtCore.SIGNAL('clicked()'), self.create_structure_push_button_clicked) # update_structure_pushButton QtCore.QObject.connect(self.update_structure_pushButton, QtCore.SIGNAL('clicked()'), self.update_structure_push_button_clicked)
def setup_signals(self): """sets up the signals """ # SIGNALS # cancel button QtCore.QObject.connect(self.cancel_pushButton, QtCore.SIGNAL("clicked()"), self.close) # select all button QtCore.QObject.connect(self.selectAll_pushButton, QtCore.SIGNAL("clicked()"), self._select_all_versions) # select none button QtCore.QObject.connect(self.selectNone_pushButton, QtCore.SIGNAL("clicked()"), self._select_no_version) # update button QtCore.QObject.connect(self.update_pushButton, QtCore.SIGNAL("clicked()"), self.update_versions) # fit column 0 on expand/collapse QtCore.QObject.connect(self.versions_treeView, QtCore.SIGNAL('expanded(QModelIndex)'), self.versions_treeView_auto_fit_column) QtCore.QObject.connect(self.versions_treeView, QtCore.SIGNAL('collapsed(QModelIndex)'), self.versions_treeView_auto_fit_column) # custom context menu for the version_treeView self.versions_treeView.setContextMenuPolicy( QtCore.Qt.CustomContextMenu) QtCore.QObject.connect( self.versions_treeView, QtCore.SIGNAL("customContextMenuRequested(const QPoint&)"), self._show_versions_treeView_context_menu)
def setup_ui(self): """creates the UI widgets """ self.setStyleSheet(""" QLabel[labelField="true"] { font-weight: bold; } """) # the main layout self.vertical_layout = QtWidgets.QVBoxLayout(self) # the form layout from anima.ui.lib import QtCore self.form_layout = QtWidgets.QFormLayout() self.form_layout.setLabelAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter) self.vertical_layout.addLayout(self.form_layout) i = -1 # ------------------------------------------------------------- # Name Field i += 1 self.name_label = QtWidgets.QLabel(self) self.name_label.setText("Name") self.name_label.setProperty("labelField", True) self.name_field = QtWidgets.QLineEdit(self) self.form_layout.setWidget(i, QtWidgets.QFormLayout.LabelRole, self.name_label) self.form_layout.setWidget(i, QtWidgets.QFormLayout.FieldRole, self.name_field) # ------------------------------------------------------------- # Type Field i += 1 self.type_label = QtWidgets.QLabel(self) self.type_label.setText("Type") self.type_label.setProperty("labelField", True) self.type_field = QtWidgets.QComboBox(self) self.form_layout.setWidget(i, QtWidgets.QFormLayout.LabelRole, self.type_label) self.form_layout.setWidget(i, QtWidgets.QFormLayout.FieldRole, self.type_field) # ------------------------------------------------------------- # Created By Field i += 1 self.created_by_label = QtWidgets.QLabel(self) self.created_by_label.setText("Created By") self.created_by_label.setProperty("labelField", True) self.created_by_field = QtWidgets.QLabel(self) self.form_layout.setWidget(i, QtWidgets.QFormLayout.LabelRole, self.created_by_label) self.form_layout.setWidget(i, QtWidgets.QFormLayout.FieldRole, self.created_by_field) # ------------------------------------------------------------- # Updated By Field i += 1 self.updated_by_label = QtWidgets.QLabel(self) self.updated_by_label.setText("Updated By") self.updated_by_label.setProperty("labelField", True) self.updated_by_field = QtWidgets.QLabel(self) self.form_layout.setWidget(i, QtWidgets.QFormLayout.LabelRole, self.updated_by_label) self.form_layout.setWidget(i, QtWidgets.QFormLayout.FieldRole, self.updated_by_field) # ------------------------------------------------------------- # Timing Field i += 1 self.timing_label = QtWidgets.QLabel(self) self.timing_label.setText("Timing") self.timing_label.setProperty("labelField", True) self.timing_field = QtWidgets.QLabel(self) self.timing_field.setText('23 Hours ago -> an Hour ago!') self.form_layout.setWidget(i, QtWidgets.QFormLayout.LabelRole, self.timing_label) self.form_layout.setWidget(i, QtWidgets.QFormLayout.FieldRole, self.timing_field) # ------------------------------------------------------------- # Priority i += 1 self.priority_label = QtWidgets.QLabel(self) self.priority_label.setText("Priority") self.priority_label.setProperty("labelField", True) self.priority_field = QtWidgets.QLabel(self) self.priority_field.setText('950') self.form_layout.setWidget(i, QtWidgets.QFormLayout.LabelRole, self.priority_label) self.form_layout.setWidget(i, QtWidgets.QFormLayout.FieldRole, self.priority_field) # Create signals QtCore.QObject.connect(self.type_field, QtCore.SIGNAL('currentIndexChanged(QString)'), self.type_field_changed)
def create(self, parent=None): """Creates the fields under the given layout :param parent: :return: """ self.parent = parent # Main Layout self.layout = QtWidgets.QHBoxLayout(parent) layout_widget = self.layout.widget() # Shot Name Field self.shot_name_field = QtWidgets.QLineEdit(layout_widget) self.layout.addWidget(self.shot_name_field) # FBX file field self.fbx_file_field = QtWidgets.QLineEdit(layout_widget) self.fbx_file_field.setPlaceholderText("Choose FBX File") self.layout.addWidget(self.fbx_file_field) # FBX Button self.fbx_choose_button = QtWidgets.QPushButton(layout_widget) self.fbx_choose_button.setText("...") self.layout.addWidget(self.fbx_choose_button) # Video file field self.video_file_field = QtWidgets.QLineEdit(layout_widget) self.video_file_field.setPlaceholderText("Choose Video File") self.layout.addWidget(self.video_file_field) # FBX Button self.video_choose_button = QtWidgets.QPushButton(layout_widget) self.video_choose_button.setText("...") self.layout.addWidget(self.video_choose_button) # Cut in Field self.cut_in_field = QtWidgets.QSpinBox() self.cut_in_field.setMinimum(0) self.cut_in_field.setMaximum(9999999) self.layout.addWidget(self.cut_in_field) # Cut out Field self.cut_out_field = QtWidgets.QSpinBox() self.cut_out_field.setMinimum(0) self.cut_out_field.setMaximum(9999999) self.layout.addWidget(self.cut_out_field) # FPS Field self.fps_field = QtWidgets.QDoubleSpinBox() self.fps_field.setMinimum(0) self.fps_field.setMaximum(9999999) self.fps_field.setDecimals(2) self.layout.addWidget(self.fps_field) # Delete Button self.delete_push_button = QtWidgets.QPushButton(layout_widget) self.delete_push_button.setText("Delete") self.layout.addWidget(self.delete_push_button) # Signals import functools # Choose FBX Push Button QtCore.QObject.connect( self.fbx_choose_button, QtCore.SIGNAL("clicked()"), functools.partial(self.fbx_choose_button_clicked)) # Choose Video Push Button QtCore.QObject.connect( self.video_choose_button, QtCore.SIGNAL("clicked()"), functools.partial(self.video_choose_button_clicked)) QtCore.QObject.connect(self.delete_push_button, QtCore.SIGNAL("clicked()"), functools.partial(self.delete)) QtCore.QObject.connect( self.video_file_field, QtCore.SIGNAL("editingFinished()"), functools.partial(self.video_file_field_changed))