Esempio n. 1
0
    def start(self):
        from files import UnionCollection
        self.mods = UnionCollection(self.game)

        MyThread.one_shot(self.load_collection,
                          on_finish=lambda v: self.populate_file_tree(),
                          parent=self.ui)
Esempio n. 2
0
    def start(self):
        from files import UnionCollection
        self.mods = UnionCollection(self.game)

        MyThread.one_shot(  self.load_collection,
                            on_finish = lambda v: self.populate_file_tree(),
                            parent = self.ui)
Esempio n. 3
0
class DataBrowser(Subsystem):
    '''Instantiates the GUI and implements user actions.
    '''
    def __init__(self, parent):
        super(Subsystem, self).__init__(parent)
        self.mods = None

    def start(self):
        from files import UnionCollection
        self.mods = UnionCollection(self.game)

        MyThread.one_shot(self.load_collection,
                          on_finish=lambda v: self.populate_file_tree(),
                          parent=self.ui)

    def stop(self):
        self.mods = None

    #################

    def load_collection(self):
        from nexus import NexusMods
        from workshop import SteamWorkshopMods
        self.mods.add_collection(NexusMods(self.game))
        self.mods.add_collection(SteamWorkshopMods(self.game))
        self.mods.parse_install()

    #@qmicro(iterations=1)
    def populate_file_tree(self):
        with self.status("Loading data tree..."):
            tree = self.ui.dataFileBrowser
            tree_model = qg.QFileSystemModel(tree)

            def show_load_message(d, show_msg=self.ui.statusBar().showMessage):
                show_msg("Loaded %s" % unicode(d), 500)

            tree_model.directoryLoaded.connect(show_load_message)

            root_idx = tree_model.setRootPath(self.game.install_path)

            tree_model = ModFilterModel(self.game,
                                        self.mods,
                                        tree_model,
                                        parent=tree)
            root_idx = tree_model.mapFromSource(root_idx)

            with widget_update(tree):
                tree.setModel(tree_model)
                tree.setRootIndex(root_idx)
Esempio n. 4
0
class DataBrowser(Subsystem):
    '''Instantiates the GUI and implements user actions.
    '''
    def __init__(self, parent):
        super(Subsystem, self).__init__(parent)
        self.mods = None

    def start(self):
        from files import UnionCollection
        self.mods = UnionCollection(self.game)

        MyThread.one_shot(  self.load_collection,
                            on_finish = lambda v: self.populate_file_tree(),
                            parent = self.ui)

    def stop(self):
        self.mods = None

    #################

    def load_collection(self):
        from nexus import NexusMods
        from workshop import SteamWorkshopMods
        self.mods.add_collection(NexusMods(self.game))
        self.mods.add_collection(SteamWorkshopMods(self.game))
        self.mods.parse_install()

    #@qmicro(iterations=1)
    def populate_file_tree(self):
        with self.status("Loading data tree..."):
            tree = self.ui.dataFileBrowser
            tree_model = qg.QFileSystemModel( tree )

            def show_load_message(d, show_msg = self.ui.statusBar().showMessage):
                show_msg("Loaded %s" % unicode(d), 500)

            tree_model.directoryLoaded.connect( show_load_message )

            root_idx = tree_model.setRootPath( self.game.install_path )

            tree_model = ModFilterModel(self.game,
                                        self.mods,
                                        tree_model,
                                        parent = tree)
            root_idx = tree_model.mapFromSource( root_idx )

            with widget_update(tree):
                tree.setModel(tree_model)
                tree.setRootIndex(root_idx)