当前位置: 首页>>代码示例>>Python>>正文


Python QTreeView.__init__方法代码示例

本文整理汇总了Python中PyQt4.Qt.QTreeView.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QTreeView.__init__方法的具体用法?Python QTreeView.__init__怎么用?Python QTreeView.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.Qt.QTreeView的用法示例。


在下文中一共展示了QTreeView.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
    def __init__(self, *args):
        QTreeView.__init__(self, *args)
        self.setStyleSheet('''
                QTreeView {
                    background-color: palette(window);
                    color: palette(window-text);
                    border: none;
                }
                QTreeView::item {
                    border: 1px solid transparent;
                    padding-top:0.5ex;
                    padding-bottom:0.5ex;
                }

                QTreeView::item:hover {
                    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
                    border: 1px solid #bfcde4;
                    border-radius: 6px;
                }
                QHeaderView::section {
                    background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
                                                    stop:0 #616161, stop: 0.5 #505050,
                                                    stop: 0.6 #434343, stop:1 #656565);
                    color: white;
                    padding-left: 4px;
                    padding-top: 0.5ex;
                    padding-bottom: 0.5ex;
                    border: 1px solid #6c6c6c;
                    font-weight: bold;
                }
        ''')
开发者ID:Eksmo,项目名称:calibre,代码行数:33,代码来源:toc.py

示例2: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
 def __init__(self, name, treemodel, parent=None):
     QTreeView.__init__(self, parent)
     self.treemodel = treemodel #bruce 081216 renamed this from ne1model
     treemodel.view = self
     self.setSelectionMode(self.ExtendedSelection) #bruce 070507 MultiSelection -> ExtendedSelection
     self.qtmodel = None
     self.drag = None
     self.setAcceptDrops(True)
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:10,代码来源:modelTreePrototype.py

示例3: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
 def __init__(self, name, ne1model, parent=None):
     QTreeView.__init__(self, parent)
     self.ne1model = ne1model
     ne1model.view = self
     self.setSelectionMode(self.ExtendedSelection) #bruce 070507 MultiSelection -> ExtendedSelection
     self.qtmodel = None
     self.drag = None
     self.setAcceptDrops(True)
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:10,代码来源:modelTreePrototype.py

示例4: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
    def __init__(self, parent=None):
        QTreeView.__init__(self, parent=None)
        self.alter_tb = None
        self.disable_recounting = False
        self.setUniformRowHeights(True)
        self.setCursor(Qt.PointingHandCursor)
        self.setIconSize(QSize(20, 20))
        self.setTabKeyNavigation(True)
        self.setAnimated(True)
        self.setHeaderHidden(True)
        self.setItemDelegate(TagDelegate(self))
        self.made_connections = False
        self.setAcceptDrops(True)
        self.setDragEnabled(True)
        self.setDragDropMode(self.DragDrop)
        self.setDropIndicatorShown(True)
        self.in_drag_drop = False
        self.setAutoExpandDelay(500)
        self.pane_is_visible = False
        self.search_icon = QIcon(I("search.png"))
        self.user_category_icon = QIcon(I("tb_folder.png"))
        self.delete_icon = QIcon(I("list_remove.png"))
        self.rename_icon = QIcon(I("edit-undo.png"))

        self._model = TagsModel(self)
        self._model.search_item_renamed.connect(self.search_item_renamed)
        self._model.refresh_required.connect(self.refresh_required, type=Qt.QueuedConnection)
        self._model.tag_item_renamed.connect(self.tag_item_renamed)
        self._model.restriction_error.connect(self.restriction_error)
        self._model.user_categories_edited.connect(self.user_categories_edited, type=Qt.QueuedConnection)
        self._model.drag_drop_finished.connect(self.drag_drop_finished)
        stylish_tb = """
                QTreeView {
                    background-color: palette(window);
                    color: palette(window-text);
                    border: none;
                }
        """
        self.setStyleSheet(
            """
                QTreeView::item {
                    border: 1px solid transparent;
                    padding-top:0.9ex;
                    padding-bottom:0.9ex;
                }

                QTreeView::item:hover {
                    background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
                    border: 1px solid #bfcde4;
                    border-radius: 6px;
                }
        """
            + ("" if gprefs["tag_browser_old_look"] else stylish_tb)
        )
        if gprefs["tag_browser_old_look"]:
            self.setAlternatingRowColors(True)
开发者ID:hashken,项目名称:calibre,代码行数:58,代码来源:view.py

示例5: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
    def __init__(self, *args):
        QTreeView.__init__(self,*args)

        self._model = Matches()
        self.setModel(self._model)

        self.rt_delegate = RichTextDelegate(self)

        for i in self._model.HTML_COLS:
            self.setItemDelegateForColumn(i, self.rt_delegate)
开发者ID:089git,项目名称:calibre,代码行数:12,代码来源:results_view.py

示例6: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
 def __init__(self, parent=None):
     QTreeView.__init__(self, parent)
     self.setHeaderHidden(True)
     self.setAnimated(True)
     self.activated.connect(self.item_activated)
     self.clicked.connect(self.item_activated)
     pi = plugins['progress_indicator'][0]
     if hasattr(pi, 'set_no_activate_on_click'):
         pi.set_no_activate_on_click(self)
     self.initialized = False
     self.setExpandsOnDoubleClick(False)
开发者ID:mapopescu,项目名称:calibre,代码行数:13,代码来源:char_select.py

示例7: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
 def __init__(self, process, block):
     QTreeView.__init__(self)
     model = BlockModel(process, block)
     self.setModel(model)
     self.setWindowTitle("%s: imalcolm" % model.block_path[0])
     root = os.path.join(os.path.dirname(__file__), "..", "..")
     icon_path = os.path.join(root, "docs", "malcolm-logo.svg")
     self.setWindowIcon(QIcon(icon_path))
     self.setColumnWidth(0, 160)
     self.setColumnWidth(1, 180)
     self.setColumnWidth(2, 25)
     self.resize(QSize(370, 500))
     self.setItemDelegateForColumn(1, Delegate())
     self.setEditTriggers(self.AllEditTriggers)
     self.expanded.connect(self.write_expanded)
     self.collapsed.connect(self.write_collapsed)
开发者ID:dls-controls,项目名称:pymalcolm,代码行数:18,代码来源:blockgui.py

示例8: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
    def __init__(self, *args):
        QTreeView.__init__(self,*args)
            
        self._model = Matches([p for p in store_plugins()])
        self.setModel(self._model)
        
        self.setIconSize(QSize(24, 24))

        self.rt_delegate = RichTextDelegate(self)

        for i in self._model.HTML_COLS:
            self.setItemDelegateForColumn(i, self.rt_delegate)

        for i in xrange(self._model.columnCount()):
            self.resizeColumnToContents(i)
            
        self.model().sort(1, Qt.AscendingOrder)
        self.header().setSortIndicator(self.model().sort_col, self.model().sort_order)
开发者ID:089git,项目名称:calibre,代码行数:20,代码来源:results_view.py

示例9: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
        def __init__(self, mmkit, parent):
            QTreeView.__init__(self, parent)

            self.setEnabled(True)
            self.model = QtGui.QDirModel(['*.mmp', '*.MMP'], # name filters
                                         QDir.AllEntries|QDir.AllDirs|QDir.NoDotAndDotDot, # filters
                                         QDir.Name # sort order
                                         )
                # explanation of filters (from Qt 4.2 doc for QDirModel):
                # - QDir.AllEntries = list files, dirs, drives, symlinks.
                # - QDir.AllDirs = include dirs regardless of other filters [guess: needed to ignore the name filters for dirs]
                # - QDir.NoDotAndDotDot = don't include '.' and '..' dirs
                #
                # about dirnames of "CVS":
                # The docs don't mention any way to filter the dirnames using a callback,
                # or any choices besides "filter them same as filenames" or "don't filter them".
                # So there is no documented way to filter out the "CVS" subdirectories like we did in Qt3
                # (short of subclassing this and overriding some methods,
                #  but the docs don't make it obvious how to do that correctly).
                # Fortunately, autoBuild.py removes them from the partlib copy in built releases.
                #
                # Other QDirModel methods we might want to use:
                # QDirModel.refresh, to update its state from the filesystem (but see the docs --
                #  they imply we might have to pass the model's root pathname to that method,
                #  even if it hasn't changed, but they're not entirely clear on that).
                #
                # [bruce 070502 comments]

            self.path = None
            self.mmkit = mmkit
            self.setModel(self.model)
            self.setWindowTitle(self.tr("Dir View"))

            self.setItemsExpandable(True)
            self.setAlternatingRowColors(True)
            self.setColumnWidth(0, 200)
            for i in range(2,4):
                self.setColumnWidth(i, 4)

            self.show()
开发者ID:alaindomissy,项目名称:nanoengineer,代码行数:42,代码来源:MMKit.py

示例10: __init__

# 需要导入模块: from PyQt4.Qt import QTreeView [as 别名]
# 或者: from PyQt4.Qt.QTreeView import __init__ [as 别名]
    def __init__(self, parent):        
        """
        The constructor of PM_TreeView class that provides provides a partlib 
        object (as a 'treeview' of any user specified directory) to the 
        client code. The parts from the partlib can be pasted in the 3D  
        Workspace.
        """
        QTreeView.__init__(self, parent)            
        self.parent = parent
        self.setEnabled(True)
        
        self.model = QDirModel(
            ['*.mmp', '*.MMP'], # name filters
            QDir.AllEntries|QDir.AllDirs|QDir.NoDotAndDotDot, # filters
            QDir.Name # sort order
            )
        
        # explanation of filters (from Qt 4.2 doc for QDirModel):
        # - QDir.AllEntries = list files, dirs, drives, symlinks.
        # - QDir.AllDirs = include dirs regardless of other filters 
        #   [guess: needed to ignore the name filters for dirs]
        # - QDir.NoDotAndDotDot = don't include '.' and '..' dirs
        #
        # about dirnames of "CVS":
        # The docs don't mention any way to filter the dirnames using a 
        # callback, or any choices besides "filter them same as filenames" or 
        # "don't filter them". So there is no documented way to filter out the 
        # "CVS" subdirectories like we did in Qt3
        # (short of subclassing this and overriding some methods,
        #  but the docs don't make it obvious how to do that correctly).
        # Fortunately, autoBuild.py removes them from the partlib copy in built 
        # releases.
        #
        # Other QDirModel methods we might want to use:
        # QDirModel.refresh, to update its state from the filesystem 
        # (but see the docs --
        #  they imply we might have to pass the model's root pathname to that 
        #  method,
        #  even if it hasn't changed, but they're not entirely clear on that).
        #
        # [bruce 070502 comments]
            
        self.path = None
        self.setModel(self.model)    
        self.setWindowTitle(self.tr("Tree View"))
        
        self.setItemsExpandable(True)
        self.setAlternatingRowColors(True)        
        self.setColumnWidth(0, 150) 
        self.setSortingEnabled(True)
        self.sortByColumn(0, Qt.AscendingOrder)
        self.setMinimumHeight(300)
        
        for i in range(2, 4):
            self.setColumnWidth(i, 4)    
        
        filePath = os.path.dirname(os.path.abspath(sys.argv[0]))
        libDir = os.path.normpath(filePath + '/../partlib')
        
        self.libPathKey = '/nanorex/nE-1/libraryPath'
        libDir = env.prefs.get(self.libPathKey, libDir)

        if os.path.isdir(libDir):
            self.rootDir = libDir
            self.setRootPath(libDir)
        else:
            self.rootDir = None
            env.history.message(redmsg("The part library directory: %s doesn't"\
                                       " exist." %libDir))
            
        self.show()
开发者ID:ematvey,项目名称:NanoEngineer-1,代码行数:73,代码来源:PM_TreeView.py


注:本文中的PyQt4.Qt.QTreeView.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。