Created
October 8, 2017 08:34
-
-
Save raytirat/753fc4ecd8bc0424329a421ccd7aafd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from PySide.QtCore import * | |
from PySide.QtGui import * | |
from widgets import ar_viewProject_UIs as ui | |
import projectListWidget | |
import createProject, projectTreeView | |
class viewProjectClass(QMainWindow, ui.Ui_viewProject): | |
def __init__(self): | |
super(viewProjectClass, self).__init__() | |
self.setupUi(self) | |
# widgets | |
self.projectList_lwd = projectListWidget.projectListClass() | |
self.projectList_ly.addWidget(self.projectList_lwd) | |
# ___________________________________________________________________ | |
self.treeList_lwd = projectTreeView.projectTreeViewClass() | |
self.treeList_ly.addWidget(self.treeList_lwd) | |
# connects | |
self.projectList_lwd.itemClicked.connect(self.rootProject) | |
# start | |
self.info_lb.setText('') | |
self.updateList() | |
def rootProject(self, item): | |
path = item.data(32) | |
print path | |
# self.treeList_lwd.setRootPath('.') | |
# self.treeList_lwd.setRootIndex(self.model.index('.')) | |
def updateList(self): | |
if not self.projectList_lwd.updateProjectList(): | |
self.projectList_lwd.updateProjectList() | |
def showInfo(self, item): | |
info = createProject.getProjectInfo(item.data(32)) | |
if info: | |
text = '''Name: | |
%s | |
Comment: | |
%s | |
''' % (info['name'], info['comment']) | |
else: | |
text = '' | |
self.info_lb.setText(text) | |
if __name__ == '__main__': | |
app = QApplication([]) | |
w = viewProjectClass() | |
w.show() | |
app.exec_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from PySide.QtCore import * | |
from PySide.QtGui import * | |
from projectListWidget import * | |
class projectTreeViewClass(QDialog): | |
def __init__(self): | |
super(projectTreeViewClass, self).__init__() | |
layout = QVBoxLayout() | |
layout.setContentsMargins(0,0,0,0) | |
self.setLayout(layout) | |
self.view = QTreeView() | |
layout.addWidget(self.view) | |
self.model = QFileSystemModel() | |
self.view.setModel(self.model) | |
if __name__ == '__main__': | |
app = QApplication([]) | |
w = projectTreeViewClass() | |
w.show() | |
app.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment