Example #1
0
    def __init__(self, category):

        modelPath = mh.getPath('models')
        gui3d.TaskView.__init__(
            self,
            category,
            'Load',
        )

        self.fileentry = self.addTopWidget(
            gui.FileEntryView('Browse', mode='dir'))
        self.fileentry.setDirectory(mh.getPath('models'))
        self.fileentry.text = mh.getPath('models')
        self.fileentry.setFilter('MakeHuman Models (*.mhm)')

        @self.fileentry.mhEvent
        def onFileSelected(dirpath):
            self.filechooser.setPaths([dirpath])
            self.filechooser.refresh()

        self.filechooser = fc.IconListFileChooser(
            modelPath,
            'mhm',
            'thumb',
            mh.getSysDataPath('notfound.thumb'),
            sort=HumanFileSort())
        self.addRightWidget(self.filechooser)
        self.addLeftWidget(self.filechooser.createSortBox())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            self.loadMHM(filename)
Example #2
0
    def __init__(self, category):

        gui3d.TaskView.__init__(self, category, 'Load')

        self.modelPath = None

        self.fileentry = self.addTopWidget(gui.FileEntryView('Browse', mode='dir'))
        self.fileentry.filter = 'MakeHuman Models (*.mhm)'

        @self.fileentry.mhEvent
        def onFileSelected(event):
            self.filechooser.setPaths([event.path])
            self.filechooser.refresh()

        self.filechooser = fc.IconListFileChooser(mh.getPath("models"), 'mhm', 'thumb', mh.getSysDataPath('notfound.thumb'), sort=HumanFileSort())
        self.addRightWidget(self.filechooser)
        self.addLeftWidget(self.filechooser.createSortBox())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            if gui3d.app.currentFile.modified:
                gui3d.app.prompt("Load", "You have unsaved changes. Are you sure you want to close the current file?",
                    "Yes", "No", lambda: gui3d.app.loadHumanMHM(filename))
            else:
                gui3d.app.loadHumanMHM(filename)
Example #3
0
    def __init__(self, category):

        gui3d.TaskView.__init__(self, category, 'Load')

        self.modelPath = None

        self.fileentry = self.addTopWidget(
            gui.FileEntryView(label='Select Folder:',
                              buttonLabel='Browse',
                              mode='dir'))
        self.fileentry.filter = 'MakeHuman Models (*.mhm)'

        # Declare new settings
        gui3d.app.addSetting('loaddir', mh.getPath("models"))

        @self.fileentry.mhEvent
        def onFileSelected(event):
            self.filechooser.setPaths([event.path])
            self.filechooser.refresh()
            # Remember load folder
            gui3d.app.setSetting('loaddir', formatPath(event.path))

        loadpath = gui3d.app.getSetting('loaddir')
        self.filechooser = fc.IconListFileChooser(
            loadpath,
            'mhm',
            'thumb',
            mh.getSysDataPath('notfound.thumb'),
            sort=HumanFileSort())
        filecache.MetadataCacher.__init__(self, ['mhm'],
                                          'models_filecache.mhc')
        self.addRightWidget(self.filechooser)
        self.addLeftWidget(self.filechooser.createSortBox())
        self.fileLoadHandler = fc.TaggedFileLoader(
            self, useNameTags=mh.getSetting('useNameTags'))
        self.filechooser.setFileLoadHandler(self.fileLoadHandler)
        self.addLeftWidget(self.filechooser.createTagFilter())

        @self.filechooser.mhEvent
        def onFileSelected(filename):
            if gui3d.app.currentFile.modified:
                gui3d.app.prompt(
                    "Load",
                    "You have unsaved changes. Are you sure you want to close the current file?",
                    "Yes", "No", lambda: gui3d.app.loadHumanMHM(filename))
            else:
                gui3d.app.loadHumanMHM(filename)