Exemplo n.º 1
0
	def __init__(self, main_window, overview_mode=True):

		"""
		desc:
			Constructor.

		arguments:
			main_window:
				desc:		The main window object.
				type:		qtopensesame

		keywords:
			overview_mode:
				desc:		Indicates whether the tree should be overview-area
							style (True) or sequence style (False).
				type:		int
		"""

		super(tree_overview, self).__init__(main_window)
		self.locked = False
		self.overview_mode = overview_mode
		self.setAcceptDrops(True)
		if self.overview_mode:
			self.setHeaderHidden(True)
		else:
			self.setHeaderHidden(False)
			self.setHeaderLabels([_(u'Item name'), _(u'Run if')])
		self.setAlternatingRowColors(True)
		self.itemChanged.connect(self.text_edited)
		self.pending_drag_data = None
		self.drag_timer = None
		if not self.overview_mode:
			shortcut(self, cfg.shortcut_edit_runif, self.start_edit_runif)
			self.append_button = tree_append_button(self)
		else:
			self.append_button = None
		shortcut(self, cfg.shortcut_context_menu, self.show_context_menu)
		shortcut(self, cfg.shortcut_rename, self.start_rename)
		shortcut(self, cfg.shortcut_copy_clipboard_unlinked,
			self.copy_item_unlinked)
		shortcut(self, cfg.shortcut_copy_clipboard_linked,
			self.copy_item_linked)
		shortcut(self, cfg.shortcut_paste_clipboard, self.paste_item)
		shortcut(self, cfg.shortcut_delete, self.delete_item)
		shortcut(self, cfg.shortcut_permanently_delete,
			self.permanently_delete_item)
		self.drop_indicator = None
		self.drop_indicator_pen = QtGui.QPen(QtGui.QBrush(
			QtGui.QColor(u'#73d216')), 2, QtCore.Qt.SolidLine)
		self.set_supported_drop_types([u'item-snippet', u'item-existing',
			u'url-local'])
Exemplo n.º 2
0
	def __init__(self, main_window, overview_mode=True):

		"""
		desc:
			Constructor.

		arguments:
			main_window:
				desc:		The main window object.
				type:		qtopensesame

		keywords:
			overview_mode:
				desc:		Indicates whether the tree should be overview-area
							style (True) or sequence style (False).
				type:		int
		"""

		super(tree_overview, self).__init__(main_window)
		self.locked = False
		self.overview_mode = overview_mode
		self.setAcceptDrops(True)
		if self.overview_mode:
			self.setHeaderHidden(True)
		else:
			self.setHeaderHidden(False)
			self.setHeaderLabels([_(u'Item name'), _(u'Run if')])
		self.setAlternatingRowColors(True)
		self.itemChanged.connect(self.text_edited)
		self.pending_drag_data = None
		self.drag_timer = None
		if not self.overview_mode:
			shortcut(self, cfg.shortcut_edit_runif, self.start_edit_runif)
			self.append_button = tree_append_button(self)
		else:
			self.append_button = None
		shortcut(self, cfg.shortcut_context_menu, self.show_context_menu)
		shortcut(self, cfg.shortcut_rename, self.start_rename)
		shortcut(self, cfg.shortcut_copy_clipboard_unlinked,
			self.copy_item_unlinked)
		shortcut(self, cfg.shortcut_copy_clipboard_linked,
			self.copy_item_linked)
		shortcut(self, cfg.shortcut_paste_clipboard, self.paste_item)
		shortcut(self, cfg.shortcut_delete, self.delete_item)
		shortcut(self, cfg.shortcut_permanently_delete,
			self.permanently_delete_item)
		self.drop_indicator = None
		self.drop_indicator_pen = QtGui.QPen(QtGui.QBrush(
			QtGui.QColor(u'#73d216')), 2, QtCore.Qt.SolidLine)
		self.set_supported_drop_types([u'item-snippet', u'item-existing',
			u'url-local'])
Exemplo n.º 3
0
    def __init__(self, main_window, overview_mode=True):

        """
		desc:
			Constructor.

		arguments:
			main_window:
				desc:		The main window object.
				type:		qtopensesame

		keywords:
			overview_mode:
				desc:		Indicates whether the tree should be overview-area
							style (True) or sequence style (False).
				type:		int
		"""

        super(tree_overview, self).__init__(main_window)
        self.locked = False
        self.overview_mode = overview_mode
        self.setAcceptDrops(True)
        if self.overview_mode:
            self.setHeaderHidden(True)
        else:
            self.setHeaderHidden(False)
            self.setHeaderLabels([_(u"Item name"), _(u"Run if")])
        self.setAlternatingRowColors(True)
        self.itemChanged.connect(self.text_edited)
        self.pending_drag_data = None
        self.drag_timer = None
        if not self.overview_mode:
            self.shortcut_edit_runif = QtGui.QShortcut(
                QtGui.QKeySequence(cfg.shortcut_edit_runif),
                self,
                self.start_edit_runif,
                context=QtCore.Qt.WidgetWithChildrenShortcut,
            )
            self.append_button = tree_append_button(self)
        else:
            self.append_button = None
        self.shortcut_rename = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_rename),
            self,
            self.start_rename,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.shortcut_copy_item = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_copy_clipboard),
            self,
            self.copy_item,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.shortcut_paste_item = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_paste_clipboard),
            self,
            self.paste_item,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.shortcut_delete_item = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_delete),
            self,
            self.delete_item,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.shortcut_delete_item = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_permanently_delete),
            self,
            self.permanently_delete_item,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.shortcut_linked_copy = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_linked_copy),
            self,
            self.create_linked_copy,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.shortcut_unlinked_copy = QtGui.QShortcut(
            QtGui.QKeySequence(cfg.shortcut_unlinked_copy),
            self,
            self.create_unlinked_copy,
            context=QtCore.Qt.WidgetWithChildrenShortcut,
        )
        self.drop_indicator = None
        self.drop_indicator_pen = QtGui.QPen(QtGui.QBrush(QtGui.QColor(u"#73d216")), 2, QtCore.Qt.SolidLine)