예제 #1
0
파일: gui.py 프로젝트: threadshare/gggg
    def __init__(self):
        self.mode_model = QtCore.QStringListModel(["Shot", "Asset"])
        self.upload_type = QtCore.QStringListModel(
            ["Attachment", "Thumbnail", "Reference_qt"])
        self.show_model = QtGui.QStandardItemModel()
        self.path_model = QtWidgets.QDirModel()

        shows = get_approved_shows()
        for show_item in shows.items():
            if show_item[1] in frozenset(['production', 'production2']):
                item = QtGui.QStandardItem(show_item[0])
                item.setData(show_item[1], SG_DATA)
                self.show_model.appendRow(item)
        self.tree_model = QtWidgets.QFileSystemModel()
        self.tree_model.setRootPath("/")
        self.none_tree = QtWidgets.QFileSystemModel()
예제 #2
0
    def __init__(self,
                 parent=None,
                 caption="",
                 directory="",
                 filter="",
                 task_context=""):
        """
        Constructs a file dialog with the given parent and caption that initially
        displays the contents of the specified directory.
        The contents of the directory are filtered before being shown in the dialog,
        using a semicolon-separated list of filters specified by each_filter.

        If you want to use multiple filters, separate each one with two semicolons. For example:

        "Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"

        :param parent:
        :param caption:
        :param directory:
        :param filter:
        :param task_context:
        """
        super(FileDialog, self).__init__(parent=parent)

        # setup UI -------------------------------------------- #
        ui_file = os.path.join(os.path.dirname(__file__), 'design',
                               'file_dialog.ui')
        uic.loadUi(ui_file, self)
        self.view_mode_btns = QtWidgets.QButtonGroup()

        self._model = QtWidgets.QFileSystemModel()
        self.task_context = task_context

        self.tree_widget.resizeEvent = self._tree_resize_event
        # self.list_view.mouseReleaseEvent = self._list_view_mouse_release_event
        self.list_view.setModel(self.tree_widget.model())

        self.file_mode = self.FilesAndDirectories

        self.create_connect()
        self.init_ui(caption, directory, filter)