Exemple #1
0
    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
        )
Exemple #2
0
    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
        )
Exemple #3
0
    def effort_time_changed(self, q_time):
        """runs when the effort has been changed
        """
        if self.updating_timings:
            return

        self.updating_timings = True

        # q_time should be a multiple of the TIMING_RESOLUTION
        q_time = self.round_to_timing_resolution(q_time)
        self.effort_time_edit.setTime(q_time)

        # q_time can not be smaller thane TIMING_RESOLUTION
        from anima import TIMING_RESOLUTION

        start_of_today = QtCore.QTime(0, 0)
        secs_since_start_of_day = start_of_today.secsTo(q_time)

        if secs_since_start_of_day < TIMING_RESOLUTION * 60:
            # clip to TIMING_RESOLUTION
            q_time = QtCore.QTime(0, 0)
            q_time = q_time.addSecs(TIMING_RESOLUTION * 60)
            self.effort_time_edit.setTime(q_time)

        start_time = self.start_time_edit.time()
        end_time = start_time.addSecs(start_of_today.secsTo(q_time))
        self.end_time_edit.setTime(end_time)

        self.updating_timings = False

        self.update_percentage()
        self.update_info_text()
Exemple #4
0
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
Exemple #5
0
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
Exemple #6
0
    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)
Exemple #7
0
    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)
Exemple #8
0
    def read_settings(self):
        """read settings from persistent storage
        """
        self.settings.beginGroup('MainWindow')

        self.resize(self.settings.value('size', QtCore.QSize(800, 600)))
        self.move(self.settings.value('pos', QtCore.QPoint(100, 100)))
        self.restoreState(self.settings.value('windowState'))

        self.settings.endGroup()
    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)
Exemple #10
0
    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)
Exemple #11
0
    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_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)
Exemple #13
0
    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")
Exemple #14
0
    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
        )
Exemple #15
0
    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)
Exemple #16
0
    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)
Exemple #17
0
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
Exemple #18
0
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
Exemple #19
0
    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)
Exemple #20
0
    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)
Exemple #21
0
    def start_time_changed(self, q_time):
        """validates the start time
        """
        if self.updating_timings:
            return

        self.updating_timings = True

        # q_time should be a multiple of the TIMING_RESOLUTION
        q_time = self.round_to_timing_resolution(q_time)
        self.start_time_edit.setTime(q_time)

        end_time = self.end_time_edit.time()
        if q_time >= end_time:
            from anima import TIMING_RESOLUTION
            logger.debug("updating end_time with set_time")
            self.end_time_edit.setTime(q_time.addSecs(TIMING_RESOLUTION * 60))
            logger.debug("updated end_time with set_time")

        start_time = self.start_time_edit.time()
        end_time = self.end_time_edit.time()

        secs = start_time.secsTo(end_time)
        logger.debug("secs: %s" % secs)
        new_time = QtCore.QTime(0, 0)
        new_time = new_time.addSecs(secs)
        logger.debug("new_time: %s" % new_time)
        logger.debug("updating end_time with set_time")
        self.effort_time_edit.setTime(new_time)
        logger.debug("updated end_time with set_time")

        self.updating_timings = False

        self.update_percentage()
        self.update_info_text()
Exemple #22
0
 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)
Exemple #23
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setup_db()

        # Authentication Storage
        self.login_action = None
        self.logout_action = None
        self.logged_in_user = self.login()

        self.project_dock_widget = None

        # import qdarkgraystyle
        # app = QtWidgets.QApplication.instance()
        #
        # from anima.ui.lib import IS_PYQT4, IS_PYSIDE, IS_PYSIDE2
        #
        # if IS_PYSIDE():
        #     app.setStyleSheet(qdarkgraystyle.load_stylesheet())
        # elif IS_PYQT4():
        #     app.setStyleSheet(qdarkgraystyle.load_stylesheet(pyside=False))
        # elif IS_PYSIDE2():
        #     app.setStyleSheet(qdarkgraystyle.load_stylesheet_pyqt5())

        # storage for UI stuff
        self.task_dashboard_widget = None
        self.tasks_tree_view = None

        # self.setWindowFlags(QtCore.Qt.ApplicationAttribute)

        self.settings = QtCore.QSettings(
            self.__company_name__,
            self.__app_name__
        )
        self.setup_ui()
Exemple #24
0
    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
        )
Exemple #26
0
    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)
Exemple #27
0
    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)
Exemple #28
0
    def stepBy(self, step):
        """Custom stepBy function

        :param step:
        :return:
        """
        if self.currentSectionIndex() == 1:
            if step < 0:
                # auto update the hour section to the next hour
                minute = self.time().minute()
                if minute == 0:
                    # increment the hour section by one
                    self.setTime(
                        QtCore.QTime(self.time().hour() - 1,
                                     60 - self.resolution))
                else:
                    self.setTime(
                        QtCore.QTime(self.time().hour(),
                                     minute - self.resolution))

            else:
                # auto update the hour section to the next hour
                minute = self.time().minute()
                if minute == (60 - self.resolution):
                    # increment the hour section by one
                    self.setTime(QtCore.QTime(self.time().hour() + 1, 0))
                else:
                    self.setTime(
                        QtCore.QTime(self.time().hour(),
                                     minute + self.resolution))
        else:
            if step < 0:
                if self.time().hour() != 0:
                    super(TimeEdit, self).stepBy(step)
            else:
                if self.time().hour() != 23:
                    super(TimeEdit, self).stepBy(step)
Exemple #29
0
    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)
Exemple #30
0
    def setup_ui(self):
        """create the UI widgets
        """
        self.vertical_layout = QtWidgets.QVBoxLayout(self)

        from anima.ui.lib import QtCore, QtGui
        # 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.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)