Ejemplo n.º 1
0
    def __init__(self, parent_widget, db):
        self.ui = uic.loadUiType("Курс.ui")[0]()
        self.ui.setupUi(parent_widget)

        self.db = db

        self.update()

        #вивід кореневої теки, де будемо шукати файли, які будемо копіювати
        filesModel = QtGui.QFileSystemModel()
        self.ui.sourcepathView.setModel(filesModel)
        self.ui.sourcepathView.setRootIndex(
            filesModel.setRootPath(self.files_path))

        #вивід теки призначення (на сервері)
        serverpathModel = QtGui.QFileSystemModel()
        self.ui.serverpathView.setModel(serverpathModel)
        #self.ui.serverpathView.setColumnWidth(0,200)
        self.ui.serverpathView.setRootIndex(
            serverpathModel.setRootPath(self.serverpath))

        #методи драп унд дроп
        self.ui.serverpathView.__class__.dragEnterEvent = self.EnterEvent
        self.ui.serverpathView.__class__.dropEvent = self.DropEvent
        self.ui.serverpathView.__class__.dragMoveEvent = self.MoveEvent

        self.ui.pushButtonSwitchId.clicked.connect(self.change_course_context)
Ejemplo n.º 2
0
    def configure_views(self):
        ## Matplotlib widget
        # Do this first to be ready with default values
        pg.setConfigOption('foreground', 'k')
        pg.setConfigOption('background', None)
        self.DataPlot = standardPlot(showHistogram=False)

        # create a layout inside the blank widget and add the matplotlib widget
        layout = QtGui.QVBoxLayout(self.view.plotWidget)
        layout.addWidget(self.DataPlot)

        ## Folder View
        # Setup folder model
        self.dirmodel = QtGui.QFileSystemModel()
        # Don't show files, just folders in folder view
        self.dirmodel.setFilter(QtCore.QDir.NoDotAndDotDot
                                | QtCore.QDir.AllDirs)
        self.view.dirView.setModel(self.dirmodel)
        self.view.dirView.clicked[QtCore.QModelIndex].connect(
            self.on_clicked_folderselected)
        self.selectionDirModel = self.view.dirView.selectionModel()
        # Don't show columns for size, file type, and last modified
        self.view.dirView.setHeaderHidden(True)
        self.view.dirView.hideColumn(1)
        self.view.dirView.hideColumn(2)
        self.view.dirView.hideColumn(3)
        self.view.dirView.setRootIndex(
            self.dirmodel.setRootPath(DATA_ROOT_FOLDER))

        ## File View
        # Setup file model
        self.filemodel = QtGui.QFileSystemModel()
        # Don't show folders, just files
        self.filemodel.setNameFilters(["*.nxs", "*sp2", "*ibw"])
        self.filemodel.setNameFilterDisables(False)
        self.filemodel.setFilter(QtCore.QDir.NoDotAndDotDot
                                 | QtCore.QDir.Files)
        self.view.fileView.setModel(self.filemodel)
        # self.view.fileView.clicked[QtCore.QModelIndex].connect(self.clicked_fileselected)
        self.selectionFileModel = self.view.fileView.selectionModel()
        self.selectionFileModel.selectionChanged.connect(self.on_fileselected)
        self.view.fileView.setRootIndex(
            self.filemodel.setRootPath(DATA_ROOT_FOLDER))
        # Configure fileView
        self.view.fileView.header().resizeSection(0, 190)
        self.view.fileView.header().resizeSection(1, 80)
        self.view.fileView.header().resizeSection(3, 110)
        self.view.fileView.hideColumn(2)  # Hide extension column, all are nxs

        ## Tools
        self.view.loadBtn.clicked.connect(self.on_loadBtnClicked)
        self.view.buildBtn.clicked.connect(self.on_buildBtnClicked)
        self.view.entriesBox.currentIndexChanged[int].connect(
            self.on_entriesBoxChanged)
Ejemplo n.º 3
0
    def __init__(self, parent=None):
        super(MyWindow, self).__init__(parent)

        # self.pathRoot = QtCore.QDir.rootPath()
        self.pathRoot = 'D:/assets_library'

        self.model = QtGui.QFileSystemModel(self)
        self.model.setRootPath(self.pathRoot)

        self.indexRoot = self.model.index(self.model.rootPath())
        self.treeView = QtGui.QTreeView(self)
        self.treeView.setModel(self.model)

        self.treeView.setRootIndex(self.indexRoot)
        self.treeView.clicked.connect(self.on_treeView_clicked)

        self.labelFileName = QtGui.QLabel(self)
        self.labelFileName.setText("File Name:")
        self.lineEditFileName = QtGui.QLineEdit(self)
        self.labelFilePath = QtGui.QLabel(self)
        self.labelFilePath.setText("File Path:")
        self.lineEditFilePath = QtGui.QLineEdit(self)
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.addWidget(self.labelFileName, 0, 0)
        self.gridLayout.addWidget(self.lineEditFileName, 0, 1)
        self.gridLayout.addWidget(self.labelFilePath, 1, 0)
        self.gridLayout.addWidget(self.lineEditFilePath, 1, 1)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addLayout(self.gridLayout)
        self.layout.addWidget(self.treeView)
Ejemplo n.º 4
0
    def newFileSystemModel(self):
        fileSystemModel = QtGui.QFileSystemModel()
        fileSystemModel.setRootPath(QtCore.QDir.rootPath())
        fileSystemModel.setNameFilterDisables(False)
        fileSystemModel.setIconProvider(self.iconProvider)

        return fileSystemModel
Ejemplo n.º 5
0
  def __init__(self):

    QtGui.QTreeView.__init__(self)
    model = QtGui.QFileSystemModel()
    model.setRootPath( QtCore.QDir.currentPath() )
    self.setModel(model)
    QtCore.QObject.connect(self.selectionModel(), QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)'), self.test)
Ejemplo n.º 6
0
    def __init__(self, useData, FILE_EXPLORER_SHORTCUTS, messagesWidget, editorTabWidget, parent=None):
        QtGui.QTreeView.__init__(self, parent)

        self.setAcceptDrops(True)

        self.setAnimated(True)
        self.setAutoScroll(True)
        self.activated.connect(self.treeItemActivated)
        self.setObjectName("sidebarItem")

        self.fileSystemModel = QtGui.QFileSystemModel()
        self.fileSystemModel.setRootPath(QtCore.QDir.rootPath())
        self.fileSystemModel.setNameFilterDisables(False)
        self.setModel(self.fileSystemModel)
        self.setColumnWidth(0, 300)

        self.useData = useData
        self.FILE_EXPLORER_SHORTCUTS = FILE_EXPLORER_SHORTCUTS
        self.messagesWidget = messagesWidget
        self.editorTabWidget = editorTabWidget

        self.manageShortcuts = ManageShortcuts(
            useData, self.FILE_EXPLORER_SHORTCUTS, self)
        self.manageShortcuts.updateShortcuts.connect(
            self.updateShortcutsActionGroup)
        editorTabWidget.addToolWidget(self.manageShortcuts)

        self.createActions()
        self.shortcutsMenu = QtGui.QMenu("Shortcuts")
        self.updateShortcutsActionGroup()
Ejemplo n.º 7
0
 def __init__(self, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.catalog=Catalog()
     self.Ard_conn=Arduino()
     self.db=Database()
     self.myQueue=Queue(self.ui.quView)
     self.player=None
     DEFAULT_HOME = "C://Users//David//Music"
     self.current_song=''
     self.last_added = ''
     self.query_dialog()
     self.model = QtGui.QFileSystemModel()
     self.model.setRootPath("C://Users//David//Music")
     self.ui.librTree.setModel(self.model)
     self.ui.librTree.setRootIndex((self.model.index("C://Users//David//Music")))
     self.ui.librTree.setColumnHidden(1, True)
     self.ui.librTree.setColumnHidden(2, True)
     self.ui.librTree.setColumnHidden(3, True)
     self.ui.librTree.clicked.connect(self.on_librTree_clicked)
     self.ui.Pause.clicked.connect(lambda: self.porp_music('Pause'))
     self.ui.Play.clicked.connect(lambda: self.porp_music('Play'))
     self.ui.Next_2.clicked.connect(lambda: self.moveBetween('Next'))
     self.ui.Prev.clicked.connect(lambda: self.moveBetween('Prev'))
     self.ui.clearQu.clicked.connect(self.myQueue.PlayQueue.clear)
     self.ui.changeTheme.clicked.connect(self.change_theme)
     self.ui.queryQu.clicked.connect(self.wind.show)
     self.ui.clearQu.clicked.connect(self.myQueue.clear)
Ejemplo n.º 8
0
    def __init__(self, width, height, homeFolder=None):
        QtGui.QTreeView.__init__(self)
        self._width = width
        self._height = height
        self.model = QtGui.QFileSystemModel()
        self.setModel(self.model)
        self.setIndentation(15)

        # Set home folder and file filters
        if not homeFolder:
            if os.path.isdir('/home/tiago'):
                #homeFolder = '/home/tiago/Code/py/NeuroDAQanalysis/testData/'
                self.homeFolder = '/home/tiago/Data/Lab.local/'
            elif platform.system() == 'Darwin':
                print 'Mac OS X detected'
                self.homeFolder = '/Users/'
            elif platform.system() == 'Linux':
                self.homeFolder = '/home/'
            else:
                self.homeFolder = '/'
        self.model.setRootPath(
            QtCore.QDir.absolutePath(QtCore.QDir(self.homeFolder)))
        self.setRootIndex(
            self.model.index(
                QtCore.QDir.absolutePath(QtCore.QDir(self.homeFolder))))
        self.model.setNameFilters(
            ['*.hdf5', '*.tdms', '*.abf', '*.avi', '*.mp4'])

        # Hide some default columns
        self.setColumnHidden(1, True)
        self.setColumnHidden(2, True)
        self.setColumnHidden(3, True)
Ejemplo n.º 9
0
 def _main(self):
     self.show()
     self.model = QtGui.QFileSystemModel(self.treeView_diskmap)
     self.model.setReadOnly(True)
     root = self.model.setRootPath(self.mRootPath)
     self.treeView_diskmap.setModel(self.model)
     self.treeView_diskmap.setRootIndex(root)
Ejemplo n.º 10
0
 def mainUiInit(self):
     ###配置文件
     key = _winreg.OpenKey(
         _winreg.HKEY_CURRENT_USER,
         r'Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
     )
     self.settingFilePath = _winreg.QueryValueEx(
         key, "Personal")[0].replace('\\',
                                     '/') + '/J_softManagerSetting.ini'
     self.modFolderPath = _winreg.QueryValueEx(key, "Personal")[0].replace(
         '\\', '/') + '/mayaMod/'
     if os.path.exists(self.modFolderPath):
         shutil.rmtree(self.modFolderPath)
     os.mkdir(self.modFolderPath)
     if os.path.exists(self.settingFilePath):
         fileTemp = open(self.settingFilePath, 'r')
         line = fileTemp.readline().decode('utf-8').replace('\n', '')
         while line != '':
             if line.find('pluginpath@') > -1:
                 self.plugInPath = line.replace('pluginpath@', '')
             line = fileTemp.readline().decode('utf-8').replace('\n', '')
         fileTemp.close()
     model = QtGui.QFileSystemModel()
     model.setRootPath('/')
     self.treeView_files.setModel(model)
Ejemplo n.º 11
0
    def make_sidebar(self):
        #目录浏览
        self.tree = TreeView()
        #self.tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        #self.connect(self.tree,SIGNAL("customContextMenuRequested(const QPoint &)"),self.doMenu)
        

        model = QtGui.QFileSystemModel()

        self.model = model
        icon = TreeViewIcon()
        model.setIconProvider(icon)
        file_filter = QtCore.QStringList(["*.md","*.txt"] )
        model.setNameFilters(file_filter)
        model.setNameFilterDisables(False)
        model.setReadOnly(False)

        self.tree.setModel(model)
        self.tree.setRootIndex(model.setRootPath(self.configs['project_path'].decode('utf8')) )
        self.tree.hideColumn(1)
        self.tree.hideColumn(2)
        self.tree.hideColumn(3)
        self.tree.header().close()

        vbox = QtGui.QVBoxLayout()
        vbox.setSpacing(0)
        project = QtGui.QLabel(Model.Model().Project_name.decode('utf8'))
        project.setStyleSheet("font-family:Microsoft Yahei;padding:5px 10px;border-bottom:1px solid #e6e6e6;background:#f3f3f3;color:#444;font-size:14px;")

        self.project_name = project
        vbox.addWidget(project)
        vbox.addWidget(self.tree)

        self.hbox.addLayout(vbox)
Ejemplo n.º 12
0
    def __init__(self):
        super(MainUI, self).__init__()
        self._platform = platform.system()
        self._generator = None
        self._timerId = None
        self.locationsDic = initDB()[0]
        self.sequenceData = []
        self.extensionDictionary = {
            "jpg": ["*.jpg", "*.jpeg"],
            "png": ["*.png"],
            "exr": ["*.exr"],
            "tif": ["*.tif", "*.tiff"],
            "tga": ["*.tga"]
        }
        self.filterList = sum(self.extensionDictionary.values(), [])

        self.setObjectName(windowName)
        self.resize(670, 624)
        self.setWindowTitle(windowName)
        self.centralwidget = QtGui.QWidget(self)
        # self.centralwidget.setObjectName(("centralwidget"))
        self.model = QtGui.QFileSystemModel()
        self.model.setRootPath(self.locationsDic["rootLocation"])
        # filter = Qt.QStringList("")
        self.model.setFilter(QtCore.QDir.AllDirs | QtCore.QDir.NoDotAndDotDot)
        self.buildUI()

        self.setCentralWidget(self.centralwidget)
Ejemplo n.º 13
0
 def explorerWidget(self):
     """File and project explorer dock panel"""
     self.explorer = QtGui.QDockWidget(self)
     self.explorer.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea)
     self.explorer.setObjectName(_fromUtf8("explorer"))
     self.explorerContent = QtGui.QWidget()
     self.explorerContent.setObjectName(_fromUtf8("explorerContent"))
     # Explorer Layout
     self.explorerLayout = QtGui.QVBoxLayout(self.explorerContent)
     self.explorerLayout.setObjectName(_fromUtf8("explorerLayout"))
     ## File browser
     self.fileBrowserView = QtGui.QTreeView(self.explorerContent)
     self.fileBrowserView.setObjectName(_fromUtf8("fileBrowserView"))
     self.explorerLayout.addWidget(self.fileBrowserView)
     model = QtGui.QFileSystemModel(self.fileBrowserView)
     model.setRootPath(QtCore.QDir.currentPath())
     self.fileBrowserView.setModel(model)
     # QtCore.QObject.connect(self.fileBrowserView.selectionModel(),
     #     QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)'),
     #     self.test)
     self.fileBrowserView.doubleClicked.connect(self.addClip2Project)
     ## Projet clips
     self.projectClips = QtGui.QTableWidget(self.explorerContent)
     self.projectClips.setObjectName(_fromUtf8("projectClips"))
     self.explorerLayout.addWidget(self.projectClips)
     self.explorer.setWidget(self.explorerContent)
Ejemplo n.º 14
0
 def refreshFileSytemModel(self):
     self.fileSystemModel = QtGui.QFileSystemModel()
     self.fileSystemModel.setRootPath(QtCore.QDir.rootPath())
     self.fileSystemModel.setNameFilters(['*.py', '*.pyw'])
     self.fileSystemModel.setNameFilterDisables(False)
     self.setModel(self.fileSystemModel)
     self.setColumnWidth(0, 300)
Ejemplo n.º 15
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
	self.text = 'Wybierz wpis \n <----'	
	self.setWindowIcon(QtGui.QIcon('./Icon/diary-no2.png'))        
	self.ui = Ui_editor()
        self.ui.setupUi(self)
	self.index = 0
	self.ui.textEdit.setText(self.text)
	self.ui.actionClear.triggered.connect(self.clear)
	self.ui.actionOpen.triggered.connect(self.file_open)
	self.ui.actionSave.triggered.connect(self.file_save)
	self.ui.actionSave_as.triggered.connect(self.file_save_as)		
	self.ui.actionInfo.triggered.connect(self.ShowAboutPopup)	
	self.ui.actionRemove.triggered.connect(self.remove_file)
	self.ui.actionnew_day.triggered.connect(self.next_day)
	self.ui.actionHelp.triggered.connect(self.Help)	
	self.currentDate = QDate.currentDate()	
	self.today = datetime.date.today().strftime('%d-%m-%Y')
	self.today_full = datetime.date.today().strftime('%A %d %B %Y')
	self.ui.label_date.setText('Dzisiaj jest: '+self.today_full.decode('utf-8'))	
    	self.filemodel = QtGui.QFileSystemModel()
	self.filemodel.setFilter(QtCore.QDir.NoDotAndDotDot | QtCore.QDir.Files)
	self.filemodel.sort(3,1)	
	self.ui.listView.setModel(self.filemodel)	
        root_index = self.filemodel.setRootPath('./Data')	
	self.ui.listView.setRootIndex(root_index)
	self.ui.listView.clicked.connect(self.clicked)
	self.ui.listView.activated.connect(self.clicked) 		
Ejemplo n.º 16
0
 def setupAssets(self):
     self.shot_assets = {}
     try:
         if not os.path.exists(self.char_asset_dir):
             raise Exception()
         charmodel = QtGui.QFileSystemModel()
         charmodel.setRootPath(self.char_asset_dir)
         charmodel.setNameFilters(["*.ma", "*.mb"])
         charmodel.setNameFilterDisables(False)
         self.char_asset_dir_view.setModel(charmodel)
         self.char_asset_dir_view.setRootIndex(
             charmodel.index(self.char_asset_dir))
     except Exception as e:
         warning = QStandardItem(self.char_asset_dir + " does not exist")
         warningmodel = QStandardItemModel()
         warningmodel.appendRow(warning)
         self.char_asset_dir_view.setModel(warningmodel)
     try:
         if not os.path.exists(self.env_asset_dir):
             raise Exception()
         charmodel = QtGui.QFileSystemModel()
         charmodel.setRootPath(self.env_asset_dir)
         charmodel.setNameFilters(["*.ma", "*.mb"])
         charmodel.setNameFilterDisables(False)
         self.env_asset_dir_view.setModel(charmodel)
         self.env_asset_dir_view.setRootIndex(
             charmodel.index(self.env_asset_dir))
     except Exception as e:
         warning = QStandardItem(self.env_asset_dir + " does not exist")
         warningmodel = QStandardItemModel()
         warningmodel.appendRow(warning)
         self.env_asset_dir_view.setModel(warningmodel)
     try:
         if not os.path.exists(self.prop_asset_dir):
             raise Exception()
         charmodel = QtGui.QFileSystemModel()
         charmodel.setRootPath(self.prop_asset_dir)
         charmodel.setNameFilters(["*.ma", "*.mb"])
         charmodel.setNameFilterDisables(False)
         self.prop_asset_dir_view.setModel(charmodel)
         self.prop_asset_dir_view.setRootIndex(
             charmodel.index(self.prop_asset_dir))
     except Exception as e:
         warning = QStandardItem(self.prop_asset_dir + " does not exist")
         warningmodel = QStandardItemModel()
         warningmodel.appendRow(warning)
         self.prop_asset_dir_view.setModel(warningmodel)
    def __init__(self, parent):
        QWidget.__init__(self)
        self.parent = parent
        self.layout = QVBoxLayout()
        self.view = Browser()
        html = '''<html>
        <head>
        <title>A Sample Page</title>
        </head>
        <body>
        <h1>No configuration selected</h1>
        
        </body>
        </html>'''

        self.view.setHtml(html)

        self.sessions_list = QtGui.QListWidget()

        self.file_layout = QHBoxLayout()
        self.config_layout = QHBoxLayout()

        self.lbl = QtGui.QLabel('No file selected')
        self.file_layout.addWidget(self.lbl)

        btn = QtGui.QPushButton('Choose file', self)
        self.file_layout.addWidget(btn)

        def open_file():
            fname = QtGui.QFileDialog.getOpenFileName(self, 'Select file')
            if fname:
                self.lbl.setText(fname)
                with open(fname) as f:
                    self.view.setHtml(f.read().replace('\n', '<br\>'))
                self.showsessions(fname)
            else:
                self.lbl.setText('No file selected')

        self.connect(btn, QtCore.SIGNAL('clicked()'), open_file)
        self.layout.addLayout(self.file_layout)
        self.path = './'

        # create model
        model = QtGui.QFileSystemModel()
        model.setRootPath(self.path)
        self.stuff = QtGui.QVBoxLayout()
        self.treeView = QtGui.QTreeView()
        # set the model
        self.treeView.setModel(model)
        self.treeView.setRootIndex(model.index(self.path))
        #self.connect(self.treeView.selectionModel(), QtCore.SIGNAL('selectionChanged(QItemSelection, QItemSelection)'), self.check_file)
        self.treeView.clicked.connect(self.check_file)
        self.config_layout.addWidget(self.treeView)
        self.config_layout.addLayout(self.stuff)
        self.stuff.addWidget(self.sessions_list)
        self.config_layout.addWidget(self.view)
        self.layout.addLayout(self.config_layout)
        self.setLayout(self.layout)
        self.show()
Ejemplo n.º 18
0
 def delete(self):
     index = self.currentIndex()
     
     temp = index.sibling(index.row(),1)
     temp = self.model().itemData(temp).values()[0].toString()   
     file_path = QtGui.QFileSystemModel().filePath(index)
     file_path = unicode(file_path,'utf-8','ignore') 
     os.remove(file_path)
Ejemplo n.º 19
0
 def __init__(self):
     super(mywin, self).__init__()
     self.setupUi(self)
     self.show()
     self.model = QtGui.QFileSystemModel()
     print(QDir.currentPath())
     self.tree_dir.setModel(self.model)
     self.tree_dir.doubleClicked.connect(self.btn_doubleclicked_check)
Ejemplo n.º 20
0
	def __init__(self,model,parent=None):
		super(FolderView,self).__init__(parent)
		
		#Table (list of experiment)
		self.table=QtGui.QTableView(self)
		self.table.horizontalHeader().setVisible(False)
		self.table.verticalHeader().setVisible(False)
		self.table.horizontalHeader().setResizeMode(QtGui.QHeaderView.ResizeToContents)
		self.table.setShowGrid(False)
		vbar=self.table.verticalScrollBar()
		self.table.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
		self.table.setModel(model)
		self.table.selectionModel().selectionChanged.connect(self.on_selection_changed)

		#ListFile (contents of one experiment folder)
		self.listFile=QtGui.QTreeView(self)
		self.listFile.header().setResizeMode(QtGui.QHeaderView.ResizeToContents)
		self.listFile.header().setStretchLastSection(True)
		self.listFile.doubleClicked.connect(self.open_selected_file)
	
		#FileSytemModel linked to listFile
		self.folderModel=QtGui.QFileSystemModel(self)
		self.folderModel.setNameFilterDisables(False)

		#open klustaviewa
		self.processViewa=QtCore.QProcess()
		#dealing with the klusta environment (not perfect)
		env = QtCore.QProcess.systemEnvironment()
		itemToReplace=[item for item in env if item.startswith('PATH=')]
		for item in itemToReplace:
			newitem=item.replace('/anaconda/bin:','/anaconda/envs/klusta/bin:')
			newitem=newitem.replace('/miniconda/bin:','/miniconda/envs/klusta/bin:')
			env.remove(item)
			env.append(newitem)
		env.append("CONDA_DEFAULT_ENV=klusta")
		self.processViewa.setEnvironment(env)

		#hide label/Edit
		self.label_hide=QtGui.QLabel('Show only:')
		self.edit_hide=QtGui.QLineEdit()
		self.edit_hide.setPlaceholderText("type 'kwik, 'pos',... and press enter")
		self.edit_hide.returnPressed.connect(self.on_enter_press)
		
		#Layout
		self.space=QtGui.QWidget()
		hbox=QtGui.QHBoxLayout()
		hbox.addWidget(vbar)
		hbox.addWidget(self.table)
		hbox.addWidget(self.space)
		hbox.addWidget(self.listFile)
		self.setLayout(hbox)

		#display empty space (no folder selected)
		self.listFile.hide()
		self.label_hide.hide()
		self.edit_hide.hide()
		self.space.show()
Ejemplo n.º 21
0
    def value(self, value):
        ControlBase.value.fset(self, value)
        model = QtGui.QFileSystemModel(parent=None)
        self._form.setModel(model)
        model.setRootPath(QtCore.QDir.currentPath())

        self._form.setRootIndex(model.setRootPath(value))

        self._form.setIconSize(QtCore.QSize(32, 32))
Ejemplo n.º 22
0
    def crea_directorio(self):

        if self.vskytube.btn_folder.text() == '>':
            self.oculta()
            self.resize(880, 321)
            self.vskytube.treeView.setVisible(True)
            self.vskytube.lbl_perfil.setVisible(True)
            self.vskytube.btn_folder_2.setVisible(True)
            self.vskytube.btn_folder.setText('<')
            self.vskytube.btn_folder.setToolTip('Motrar Videos')
            if 'win32' in self.sistema() or 'win64' in self.sistema():
                self.vskytube.lbl_perfil.setText(
                    (os.path.join(os.environ['USERPROFILE'], 'videos')))
            if 'darwin' in self.sistema():
                self.vskytube.lbl_perfil.setText(
                    (os.path.join(os.environ['HOME'], 'Movies')))
            if 'linux' in self.sistema():
                if os.path.isdir(os.path.join(os.environ['HOME'], 'Movies')):
                    self.vskytube.lbl_perfil.setText(
                        (os.path.join(os.environ['HOME'], 'Movies')))
                else:
                    os.system('mkdir $HOME/Movies')
                    self.vskytube.lbl_perfil.setText(
                        (os.path.join(os.environ['HOME'], 'Movies')))

        else:
            self.resize(585, 121)
            self.vskytube.treeView.setVisible(False)
            self.vskytube.lbl_perfil.setVisible(False)
            self.vskytube.btn_folder_2.setVisible(False)
            self.vskytube.lbl_perfil.setVisible(False)
            self.vskytube.btn_folder.setText('>')
            self.vskytube.btn_folder.setToolTip('Ocultar Videos')
            self.vskytube.lbl_perfil.setVisible(False)

        global fileSystemModel
        fileSystemModel = QtGui.QFileSystemModel(self.vskytube.treeView)
        fileSystemModel.setReadOnly(True)

        if 'win32' in self.sistema() or 'win64' in self.sistema():
            fileSystemModel.setRootPath(
                str((os.path.join(os.environ['USERPROFILE'], 'videos'))))
            indexRoot = fileSystemModel.index(fileSystemModel.rootPath())
            self.vskytube.treeView.setModel(fileSystemModel)
            self.vskytube.treeView.setRootIndex(indexRoot)
        elif 'darwin' in self.sistema() or 'linux' in self.sistema():
            fileSystemModel.setRootPath(
                str((os.path.join(os.environ['HOME'], 'Movies'))))
            indexRoot = fileSystemModel.index(fileSystemModel.rootPath())
            self.vskytube.treeView.setModel(fileSystemModel)
            self.vskytube.treeView.setRootIndex(indexRoot)

        self.vskytube.treeView.setColumnHidden(1, True)
        self.vskytube.treeView.setColumnHidden(2, True)
        self.vskytube.treeView.setColumnHidden(3, True)
        self.vskytube.treeView.setHeaderHidden(True)
Ejemplo n.º 23
0
def setRealDirView(object, layout):
    object.realdir = treeview.CoolTreeView()
    object.realdirmodel = QtGui.QFileSystemModel()
    object.realdirmodel.setRootPath(QtCore.QDir.currentPath())
    object.realdir.setModel(object.realdirmodel)
    object.realdir.setColumnWidth(0, namecolumn_width)
    object.realdir.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
    object.realdir.customContextMenuRequested.connect(object.filemenu)
    layout.addWidget(object.realdir)
    object.realdir.expand_path(QtCore.QDir.currentPath())
Ejemplo n.º 24
0
 def btn_click(self):
     file_dialog = QtGui.QFileDialog()
     folder = file_dialog.getExistingDirectory(None, "Select Folder")
     model = QtGui.QFileSystemModel()
     model.setRootPath(QDir.rootPath())
     self.model = model
     tree = self.treeView
     tree.setModel(model)
     tree.setRootIndex(model.index(folder))
     tree.setColumnHidden(1, True)
     tree.setColumnHidden(2, True)
     tree.setColumnHidden(3, True)
    def initUI(self):

        self.model = QtGui.QFileSystemModel()
        homedir = QtCore.QDir.home().path()
        self.model.setRootPath(homedir)

        tv = QtGui.QTreeView(self)
        tv.setModel(self.model)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(tv)
        self.setLayout(layout)
Ejemplo n.º 26
0
    def __init__(self, parent=None):
        super(QMT, self).__init__(parent)
        # Create Qtable view widget
        self.view = QtGui.QTableView(self)
        self.view.clicked.connect(self.viewClicked)

        # Get the header to catch clicked on it
        self.header = self.view.horizontalHeader()
        self.header.sectionClicked.connect(self.headerClicked)
        self.view.setSortingEnabled(True)

        # Create Canvas for graph
        self.fig = Figure(figsize=(5, 5), dpi=100)
        self.canvas = FigureCanvas(self.fig)
        self.graph = self.fig.add_subplot(111)

        # Create Series Datas
        self.QStat = QtGui.QLabel("Stats", self)

        # File browser
        self.treeView = QtGui.QTreeView(self)
        self.fileSystemModel = QtGui.QFileSystemModel(self.treeView)
        self.fileSystemModel.setReadOnly(True)
        root = self.fileSystemModel.setRootPath('Z:/resultats/807677')
        self.treeView.setModel(self.fileSystemModel)
        self.treeView.setRootIndex(root)
        self.treeView.clicked.connect(self.treeView_clicked)

        #Layout management
        #Initiate splitter
        splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal)
        splitter2 = QtGui.QSplitter(QtCore.Qt.Vertical)
        splitter1.addWidget(self.treeView)
        splitter1.addWidget(self.canvas)
        splitter1.addWidget(self.QStat)

        splitter2.addWidget(splitter1)
        splitter2.addWidget(self.view)

        #Horizontal Layout Box
        hbox = QtGui.QVBoxLayout()
        hbox.addWidget(splitter2)

        #initiate widget to be shown
        widget = QtGui.QWidget(self)
        widget.setLayout(hbox)

        #Set widget as central widget
        self.setCentralWidget(widget)

        # Windows & Menu stuff
        self.initUI()
    def __init__(self):
        super(location_treeview_form, self).__init__()
        self.setupUi(self)
        self.model = QtGui.QFileSystemModel()
        self.model.setRootPath(QtCore.QDir.rootPath())
        self.model.setFilter(QtCore.QDir.NoDotAndDotDot | QtCore.QDir.Dirs)
        self.location_path_treeview.setModel(self.model)

        self.location_path_treeview.hideColumn(1)
        self.location_path_treeview.hideColumn(2)
        self.location_path_treeview.hideColumn(3)
        self.location_path_treeview.clicked.connect(self.on_treeview_clicked)
        self.SelectedItem = ""
Ejemplo n.º 28
0
    def initUI(self):

        self.resize(700, 500)
        self.treeView = QtGui.QTreeView()
        self.fileSystemModel = QtGui.QFileSystemModel(self.treeView)
        self.fileSystemModel.setReadOnly(False)
        self.fileSystemModel.setRootPath(QtCore.QDir.currentPath())
        root = self.fileSystemModel.setRootPath("/")
        self.treeView.setModel(self.fileSystemModel)
        self.treeView.setRootIndex(root)

        Layout = QtGui.QVBoxLayout(self)
        Layout.addWidget(self.treeView)
Ejemplo n.º 29
0
    def __init__(self, parent=maya_main_window()):
        QtGui.QDialog.__init__(self, parent)

        layout = QtGui.QVBoxLayout()
        self.setLayout(layout)

        self.treeView = QtGui.QTreeView(parent=self)

        self.setObjectName('tmLibrary')
        self.setWindowTitle('Tapp Library')

        self.setFixedHeight(500)
        self.setFixedWidth(500)

        self.model = QtGui.QFileSystemModel()
        self.model.setFilter(QtCore.QDir.Dirs | QtCore.QDir.NoDotAndDotDot)

        root = self.model.setRootPath('c:/library')

        self.treeView.setModel(self.model)
        self.treeView.setRootIndex(root)

        self.treeView.setHeaderHidden(True)
        self.treeView.setColumnHidden(1, True)
        self.treeView.setColumnHidden(2, True)
        self.treeView.setColumnHidden(3, True)

        layout.addWidget(self.treeView)

        self.treeView.clicked.connect(self.on_treeView_clicked)

        #------------------------------------------

        self.listwidget = QtGui.QListWidget()
        self.listwidget.setViewMode(QtGui.QListView.IconMode)
        self.listwidget.setMovement(QtGui.QListView.Static)
        self.listwidget.setIconSize(QtCore.QSize(100, 100))

        self.listwidget.doubleClicked.connect(self.on_listwidget_doubleclicked)

        layout.addWidget(self.listwidget)

        #------------------------------------------

        self.thumbslider = QtGui.QSlider()
        self.thumbslider.setOrientation(QtCore.Qt.Horizontal)

        self.thumbslider.valueChanged.connect(self.on_thumbslider_changed)

        layout.addWidget(self.thumbslider)
Ejemplo n.º 30
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.application = QtGui.QApplication.instance()

        model = QtGui.QFileSystemModel(self)
        model.setRootPath(QtCore.QDir.rootPath())
        model.setFilter(QtCore.QDir.Dirs)
        self.completerFileSystem = QtGui.QCompleter(model, self)
        self.lineLocation.setCompleter(self.completerFileSystem)

        self.setupComboTemplates()
        self.buttonCreate.setDefault(True)
        self.projectCreated = None
        self.userEnvironment = []