def on_edit(self):
     item = self.lstGroups.currentItem().data(Qt.UserRole)
     edit_dialog = GroupEditDialog()
     edit_dialog.setWindowTitle(self.tr('Edit group'))
     edit_dialog.set_group_info(item)
     if edit_dialog.exec_() == QDialog.Accepted:
         self.feel_list()
         self.ds_model.resetModel()
    def on_copy(self):
        select_group_dialog = QDialog(self)
        select_group_dialog.setWindowTitle(self.tr("Choose source group"))
        layout = QVBoxLayout(select_group_dialog)
        select_group_dialog.setLayout(layout)

        groups_list_view = QTableView(self)
        layout.addWidget(groups_list_view)
        groups_list_view.setModel(self.ds_model)
        groups_list_view.setColumnHidden(DSManagerModel.COLUMN_VISIBILITY, True)
        groups_list_view.horizontalHeader().setResizeMode(DSManagerModel.COLUMN_GROUP_DS, QHeaderView.Stretch)
        groups_list_view.setSelectionMode(QTableView.NoSelection)
        groups_list_view.setAlternatingRowColors(True)
        groups_list_view.setShowGrid(False)
        groups_list_view.verticalHeader().setResizeMode(QHeaderView.ResizeToContents)
        groups_list_view.verticalHeader().hide()
        groups_list_view.clicked.connect(
            lambda index: select_group_dialog.accept() \
                if self.ds_model.isGroup(index) and \
                    index.column() == DSManagerModel.COLUMN_GROUP_DS \
                else None
        )

        if select_group_dialog.exec_() == QDialog.Accepted:
            group_info = self.ds_model.data(groups_list_view.currentIndex(), Qt.UserRole)
            group_info.id += "_copy"
            edit_dialog = GroupEditDialog()
            edit_dialog.setWindowTitle(self.tr('Create group from existing'))
            edit_dialog.fill_group_info(group_info)
            if edit_dialog.exec_() == QDialog.Accepted:
                self.feel_list()
                self.ds_model.resetModel()
 def on_edit(self):
     item = self.lstGroups.currentItem().data(Qt.UserRole)
     edit_dialog = GroupEditDialog()
     edit_dialog.setWindowTitle(self.tr('Edit group'))
     edit_dialog.set_group_info(item)
     if edit_dialog.exec_() == QDialog.Accepted:
         self.feel_list()
         self.ds_model.resetModel()
    def on_copy(self):
        select_group_dialog = QDialog(self)
        select_group_dialog.resize(300, 400)
        select_group_dialog.setWindowTitle(self.tr("Choose source group"))
        layout = QVBoxLayout(select_group_dialog)
        select_group_dialog.setLayout(layout)

        groups_list_view = QTableView(self)
        layout.addWidget(groups_list_view)
        groups_list_view.setModel(self.ds_model)
        groups_list_view.setColumnHidden(DSManagerModel.COLUMN_VISIBILITY,
                                         True)
        groups_list_view.horizontalHeader().setResizeMode(
            DSManagerModel.COLUMN_GROUP_DS, QHeaderView.Stretch)
        groups_list_view.setSelectionMode(QTableView.NoSelection)
        groups_list_view.setAlternatingRowColors(True)
        groups_list_view.setShowGrid(False)
        groups_list_view.verticalHeader().setResizeMode(
            QHeaderView.ResizeToContents)
        groups_list_view.verticalHeader().hide()
        groups_list_view.clicked.connect(
            lambda index: select_group_dialog.accept() \
                if self.ds_model.isGroup(index) and \
                    index.column() == DSManagerModel.COLUMN_GROUP_DS \
                else None
        )

        if select_group_dialog.exec_() == QDialog.Accepted:
            group_info = self.ds_model.data(groups_list_view.currentIndex(),
                                            Qt.UserRole)
            group_info.id += "_copy"
            edit_dialog = GroupEditDialog()
            edit_dialog.setWindowTitle(self.tr('Create group from existing'))
            edit_dialog.fill_group_info(group_info)
            if edit_dialog.exec_() == QDialog.Accepted:
                self.feel_list()
                self.ds_model.resetModel()
 def on_add(self):
     edit_dialog = GroupEditDialog()
     edit_dialog.setWindowTitle(self.tr('Create group'))
     if edit_dialog.exec_() == QDialog.Accepted:
         self.feel_list()
         self.ds_model.resetModel()
 def on_add(self):
     edit_dialog = GroupEditDialog()
     edit_dialog.setWindowTitle(self.tr('Create group'))
     if edit_dialog.exec_() == QDialog.Accepted:
         self.feel_list()
         self.ds_model.resetModel()