Beispiel #1
0
    def __init__(self):
        # These are the modifier URLs that have been explicitly enabled by the user.  This odesn't
        # include modifiers that are enabled due to dependencies.
        self.active_modifiers = set()

        # These are the modifier URLs that have been marked dynamic by the user.
        self.dynamic_modifiers = set()

        self.prefs = prefs.load_prefs()

        self.current_modifier_info = None
Beispiel #2
0
def go():
    mh.setup_logging()
    qt_path = os.path.dirname(__file__) + '/qt/'
    qtpy_path = os.path.dirname(__file__) + '/qtpy/'
    for fn in os.listdir(qt_path):
        if not fnmatch(fn, '*.ui'):
            continue

        input_file = qt_path + fn
        output_file = qtpy_path + fn.replace('.ui', '.py')
        if mtime(input_file) < mtime(output_file):
            continue

        with open(input_file) as input:
            with open(output_file, 'w') as output:
                Qt.pysideuic.compileUi(input, output)

    main_window_ptr = omui.MQtUtil.mainWindow()
    main_window = Qt.wrapInstance(long(main_window_ptr), Qt.QWidget)

    current_prefs = prefs.load_prefs()

    picker = Qt.QFileDialog(main_window,
                            caption='Open DSON scene',
                            filter='DUF (*.duf)')

    # Restore the last directory the user was in.
    if 'last_path' in current_prefs:
        picker.setDirectory(current_prefs['last_path'])

    def import_file_queued(path):
        # Save the directory the user was in.
        current_prefs['last_path'] = picker.directory().absolutePath()
        prefs.save_prefs(current_prefs)

        # Wait for an event loop cycle, or the open dialog will stay on screen while we load
        # data.
        def run_import():
            import_file(path)

        Qt.QTimer.singleShot(0, run_import)

    picker.fileSelected.connect(import_file_queued)
    picker.setAcceptMode(Qt.QFileDialog.AcceptOpen)
    picker.setFileMode(Qt.QFileDialog.ExistingFile)
    picker.show()
                    period_time = int(min_sec[0]) * 2 + 1

                if period_time == 0:
                    raise Exception('Incorrectly formatted period times')

                script['periods'].append(period_time)
            except ValueError:
                raise Exception('Incorrectly formatted period times')

    return script


if __name__ == '__main__':
    try:
        prefs, load_pref_errors = load_prefs(
            os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])),
                         'prefs.json'))
        if load_pref_errors:
            print(load_pref_errors)

        # Attempt to load up music library.
        try:
            if prefs['music_library_prefs']['music_library_path']:
                music_library_path = prefs['music_library_prefs'][
                    'music_library_path']
                music_library = ml.load_library(music_library_path)
            else:
                music_library = None
        except (FileNotFoundError, IOError):
            music_library = None