Ejemplo n.º 1
0
    def __init__( self, parent, referenceComponent = None ):
        super( OldInput, self ).__init__( parent )

        self.selectedInput = None

        dialog = self.dialog = QtGui.QDialog( self.parent() )
        dialog.setLayout( QtGui.QVBoxLayout() )

        tree = TreeView()
        treeWidget = TreeWidget( tree, 'Get existing input' )
        model = ColorComponentModel()
        model.setRoot( ComponentModel().rootComponent )

        isInput = lambda comp: isinstance( comp, Input )
        model.addColorCondition( isInput , 'red', QtGui.QFont.Bold )
        model.addCycler( tree, isInput, treeWidget.addButton( 'Next' ) )
        if referenceComponent:
            model.insertColorCondition( 0, referenceComponent, 'blue', QtGui.QFont.Bold )
            cycler = model.addCycler( tree, referenceComponent, treeWidget.addButton( 'Current input' ) )
            for i in range( len( cycler.items ) ):
                cycler.next()

        tree.setModel( model )

        def itemSelected( component ):
            if isinstance( component, Input ):
                self.selectedInput = component
                dialog.accept()

        tree.doubleClicked.connect( lambda index: itemSelected( model.itemFromIndex( index ).component ) )

        dialog.layout().addWidget( treeWidget )
Ejemplo n.º 2
0
class ResaultGui(object):
    def __init__(self, master, model, ntfsvol):
        """
        :param model: MftModel object
        """
        self.ntfsvol = ntfsvol
        self.filled = Tk.IntVar()
        # Gui
        Tk.Label(master, text='Delete file/folder browse', width=80).pack()
        self.tree = TreeView(master, model, height=400)
        self.tree.pack(expand=Tk.YES, fill=Tk.BOTH, pady=5)
        fill_btn = Tk.Checkbutton(master, text='Fill data with zero', variable=self.filled, state=Tk.DISABLED)
        fill_btn.pack(side=Tk.LEFT, anchor=Tk.SW)
        Tk.Button(master, text='Shred', command=self.shared).pack(side=Tk.RIGHT, anchor=Tk.SE, padx=15, pady=5)
        
    def shared(self):
        """Shared file"""
        for sel in self.tree.get_selects():
            mftno = int(self.tree.hlist.info_data(sel)) 
            if mftno:
                if self.tree.model.mfts_dict[mftno].isExists == False:
                    self.ntfsvol.shred(mftno, self.filled.get())
                    self.tree.hlist.delete_entry(sel)
            else:
                self.tree.hlist.delete_entry(sel) # like DIRXXXX
            print 'delete entry', sel
Ejemplo n.º 3
0
 def __init__( self, condition = lambda component: True ):
     super( ClipBoardBrowser, self ).__init__()
     tree = TreeView()
     tree.setModel( ClipBoardModel() )
     layout = QtGui.QVBoxLayout( self )
     layout.addWidget( TreeWidget( tree ) )
     tree.doubleClicked.connect( lambda index: self.componentSelected( tree.model().itemFromIndex( index ).component ) )
     self.condition = condition
Ejemplo n.º 4
0
    def __init__( self, parent, condition = None, delegate = None ):
        super( ClipBoardSelectDialog, self ).__init__( parent )
        tree = TreeView()
        tree.setModel( ClipBoardModel() )
        if delegate: tree.setItemDelegate( delegate )

        condition = condition( self ) if condition else lambda component: True

        def doubleClicked( index ):
            if not index.isValid(): return
            component = tree.model().itemFromIndex( index ).component
            if condition( component ):
                self.result = component
                self.accept()

        tree.doubleClicked.connect( doubleClicked )

        layout = QtGui.QVBoxLayout( self )
        layout.addWidget( TreeWidget( tree, 'Get from Clip board' ) )
        self.condition = condition
Ejemplo n.º 5
0
 def __init__(self, master, model, ntfsvol):
     """
     :param model: MftModel object
     """
     self.ntfsvol = ntfsvol
     self.filled = Tk.IntVar()
     # Gui
     Tk.Label(master, text='Delete file/folder browse', width=80).pack()
     self.tree = TreeView(master, model, height=400)
     self.tree.pack(expand=Tk.YES, fill=Tk.BOTH, pady=5)
     fill_btn = Tk.Checkbutton(master, text='Fill data with zero', variable=self.filled, state=Tk.DISABLED)
     fill_btn.pack(side=Tk.LEFT, anchor=Tk.SW)
     Tk.Button(master, text='Shred', command=self.shared).pack(side=Tk.RIGHT, anchor=Tk.SE, padx=15, pady=5)