Ejemplo n.º 1
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)
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
    def setup_ui(self, dialog):
        """Sets up the dialog

        :param dialog: QtGui.QDialog instance
        :return:
        """
        dialog.setObjectName("Dialog")
        dialog.setWindowModality(QtCore.Qt.ApplicationModal)
        dialog.resize(1200, 800)
        # layout vertical first
        self.vertical_layout = QtWidgets.QVBoxLayout(dialog)
        self.vertical_layout.setObjectName('verticalLayout1')

        self.horizontal_layout = QtWidgets.QHBoxLayout()

        self.from_task_tree_view = QtWidgets.QTreeView(dialog)
        self.from_task_tree_view.setObjectName("from_tasks_treeView")

        self.copy_push_button = QtWidgets.QPushButton(dialog)
        self.copy_push_button.setObjectName("copy_push_button")
        self.copy_push_button.setText('>')

        self.to_task_tree_view = TaskTreeView(dialog)
        self.to_task_tree_view.setObjectName("to_tasks_treeView")

        # self.horizontal_layout1.addWidget(self.from_task_tree_view)
        self.horizontal_layout.addWidget(self.from_task_tree_view)
        self.horizontal_layout.addWidget(self.copy_push_button)
        self.horizontal_layout.addWidget(self.to_task_tree_view)

        self.vertical_layout.addLayout(self.horizontal_layout)

        self.horizontal_layout_2 = QtWidgets.QHBoxLayout()
        self.horizontal_layout_2.setContentsMargins(-1, 10, -1, -1)
        self.horizontal_layout_2.setObjectName("horizontal_layout_2")

        self.vertical_layout.addLayout(self.horizontal_layout_2)

        QtCore.QMetaObject.connectSlotsByName(dialog)

        # initialize elements

        logged_in_user = self.get_logged_in_user()
        projects = Project.query.order_by(Project.name).all()

        task_tree_model = TaskTreeModel()
        task_tree_model.user = logged_in_user
        task_tree_model.populateTree(projects)

        # fit to elements
        self.from_tasks_tree_view_auto_fit_column()
        self.to_tasks_tree_view_auto_fit_column()

        self.from_task_tree_view.setModel(task_tree_model)
        self.to_task_tree_view.setModel(task_tree_model)

        # setup signals
        # tasks_treeView
        QtCore.QObject.connect(
            self.from_task_tree_view.selectionModel(),
            QtCore.SIGNAL('selectionChanged(const QItemSelection &, '
                          'const QItemSelection &)'),
            self.from_task_tree_view_changed)

        QtCore.QObject.connect(
            self.to_task_tree_view.selectionModel(),
            QtCore.SIGNAL('selectionChanged(const QItemSelection &, '
                          'const QItemSelection &)'),
            self.to_task_tree_view_changed)

        # fit column 0 on expand/collapse
        QtCore.QObject.connect(self.from_task_tree_view,
                               QtCore.SIGNAL('expanded(QModelIndex)'),
                               self.from_tasks_tree_view_auto_fit_column)

        QtCore.QObject.connect(self.to_task_tree_view,
                               QtCore.SIGNAL('expanded(QModelIndex)'),
                               self.to_tasks_tree_view_auto_fit_column)

        # copy_push_button
        QtCore.QObject.connect(self.copy_push_button,
                               QtCore.SIGNAL("clicked()"), self.copy_versions)