Esempio n. 1
0
def create_radio_buttons(text,
                         labels,
                         parent,
                         parent_layout,
                         width=120,
                         add_stretch=True):
    rbs = []
    layout = create_box_layout(ORIENTATION.HORIZONTAL, margin=0)

    if text is not None:
        layout.addWidget(create_label(text, width=80))

    button_grp = QtWidgets.QButtonGroup(parent)

    for l in labels:
        rb = QtWidgets.QRadioButton(l)
        rb.setFixedWidth(width)
        rbs.append(rb)
        button_grp.addButton(rb)
        layout.addWidget(rb)

    if add_stretch:
        layout.addStretch(1)

    parent_layout.addLayout(layout)
    return tuple(rbs)
Esempio n. 2
0
    def _build_file(self):
        h_layout = create_box_layout(ORIENTATION.HORIZONTAL, margin=2)
        h_layout.addWidget(create_label("File: "))
        self._file_path = QtWidgets.QLineEdit()
        h_layout.addWidget(self._file_path)
        self._search_file_button = QtWidgets.QPushButton("Search")
        h_layout.addWidget(self._search_file_button)
        self._layout.addLayout(h_layout)

        self._options_group = QtWidgets.QGroupBox("Options")
        v_layout = create_box_layout(ORIENTATION.VERTICAL, margin=2)
        self._options_group.setLayout(v_layout)

        self._data_export, self._tar_export = create_radio_buttons("Data: ",
                    ['Data Only', "Data And Images"], self, v_layout)

        self._selection, self._hierarchy = create_radio_buttons("Hierarchy: ",
                    ["Selection", "Below"], self, v_layout)
        self._hierarchy.setEnabled(self._manager.facade.support_hierarchy())

        self._all_frames, self._gui_range, self._start_end = \
                    create_radio_buttons("Frames:", ["All", "GUI Frame Range",
                                         "Start/End"], self, v_layout)

        self._frame_range = FrameRange(self)
        v_layout.addWidget(self._frame_range)

        self._layout.addWidget(self._options_group)
Esempio n. 3
0
    def __init__(self, manager, app_preference_widget=None):
        super(KikoExporterDialog, self).__init__()

        self._manager = manager
        facade = self._manager.facade
        self._image_generation = facade.supports_image_generation()

        app_name = facade.get_app_name().capitalize()
        self.setWindowTitle(app_name + ' Kiko Exporter')
        self._layout = create_box_layout(ORIENTATION.VERTICAL)
        self.setLayout(self._layout)

        self._app_preference_widget = app_preference_widget
        if app_preference_widget:
            tab_widget = QtWidgets.QTabWidget(self)
            self._layout.addWidget(tab_widget)
            self._layout.setContentsMargins(0, 0, 0, 0)

            widget = QtWidgets.QWidget(self)
            self._layout = create_box_layout(ORIENTATION.VERTICAL)
            widget.setLayout(self._layout)
            tab_widget.addTab(widget, "Export")

            tab_widget.addTab(app_preference_widget, app_name + " Preferences")

        self.resize(500, 400)

        self._build_widgets()
        self._initialize_widgets()
        self._connect_signals()
Esempio n. 4
0
 def _build_widgets(self, width):
     self._layout.addWidget(create_label("Frame Range: ", width=width))
     self._start_frame = QtWidgets.QSpinBox()
     self._start_frame.setRange(-10000000, 1000000)
     self._layout.addWidget(self._start_frame)
     self._end_frame = QtWidgets.QSpinBox()
     self._end_frame.setRange(-10000000, 1000000)
     self._layout.addWidget(self._end_frame)
Esempio n. 5
0
 def _build_file(self):
     h_layout = create_box_layout(ORIENTATION.HORIZONTAL, margin=2)
     h_layout.addWidget(create_label("File: "))
     self._file_path = QtWidgets.QLineEdit()
     h_layout.addWidget(self._file_path)
     self._search_file_button = QtWidgets.QPushButton("Search")
     h_layout.addWidget(self._search_file_button)
     self._layout.addLayout(h_layout)
Esempio n. 6
0
def create_box_layout(orientation, margin=None, spacing=None):

    if orientation == ORIENTATION.VERTICAL:
        layout = QtWidgets.QVBoxLayout()
    elif orientation == ORIENTATION.HORIZONTAL:
        layout = QtWidgets.QHBoxLayout()

    if not spacing is None:
        layout.setSpacing(spacing)
    if not margin is None:
        layout.setContentsMargins(margin, margin, margin, margin)

    return layout
Esempio n. 7
0
    def _build_operators(self):
        self._operators_group = QtWidgets.QGroupBox("Operators")
        h_layout = create_box_layout(ORIENTATION.HORIZONTAL, margin=2)
        self._operators_group.setLayout(h_layout)

        self._operator_list = QtWidgets.QListWidget()
        self._operator_list.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        h_layout.addWidget(self._operator_list)

        self._force_all = QtWidgets.QCheckBox("Force Evaluation")
        h_layout.addWidget(self._force_all, 0, QtCore.Qt.AlignTop)

        self._layout.addWidget(self._operators_group)
Esempio n. 8
0
    def _build_mapping(self):
        widget = QtWidgets.QWidget()
        v_layout = create_box_layout(ORIENTATION.VERTICAL, margin=5,
                                     spacing=10)
        widget.setLayout(v_layout)
        self._tab_widget.addTab(widget, "Mapping")

        v_layout.addWidget(QtWidgets.QLabel('Channel and Item mapping takes '
                                            'precedence over name management.'))

        v_layout.addWidget(create_separator(ORIENTATION.HORIZONTAL))

        self._mapping = DataTreeAndSearchWidget(parent=self,
                                                facade=self._manager.facade)

        v_layout.addWidget(self._mapping)
Esempio n. 9
0
    def _buid_widgets(self, root, show_channels, show_chunks, facade):
        h_layout = create_box_layout(ORIENTATION.HORIZONTAL,
                                     margin=0,
                                     spacing=10)
        self._layout.addLayout(h_layout)

        self._search_field = QtWidgets.QLineEdit(self)
        h_layout.addWidget(self._search_field)

        self._search_button = QtWidgets.QPushButton(self)
        self._search_button.setIcon(QtGui.QIcon(get_image("search.png")))
        h_layout.addWidget(self._search_button)

        self._data_tree = DataTreeWidget(root=root,
                                         show_channels=show_channels,
                                         show_chunks=show_chunks,
                                         parent=self,
                                         facade=facade)
        self._layout.addWidget(self._data_tree)
Esempio n. 10
0
    def _build_string(self):
        widget = QtWidgets.QWidget()
        v_layout = create_box_layout(ORIENTATION.VERTICAL, margin=5,
                                     spacing=10)
        widget.setLayout(v_layout)
        self._tab_widget.addTab(widget, "Names")

        h_layout1 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=0)
        h_layout1.addWidget(create_label("String Replacement: ", width=115))
        self._str_repl_table = QtWidgets.QTableWidget(self)
        self._str_repl_table.setRowCount(1)
        self._str_repl_table.setColumnCount(2)
        self._str_repl_table.setHorizontalHeaderLabels(["From", "To"])
        self._str_repl_table.setColumnWidth(0, 125)
        self._str_repl_table.horizontalHeader().setStretchLastSection(True)
        self._str_repl_table.horizontalHeader().setSectionsClickable(False)
        self._str_repl_table.verticalHeader().setVisible(False)
        self._str_repl_table.setAlternatingRowColors(True)
        self._str_repl_table.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        self._str_repl_table.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        h_layout1.addWidget(self._str_repl_table)
        v_layout.addLayout(h_layout1)

        self._str_repl_menu = QtWidgets.QMenu(self)
        self._str_repl_add_row = self._str_repl_menu.addAction("Add Row")
        self._str_repl_del_row = self._str_repl_menu.addAction("Delete Row")
        self._str_repl_del_all = self._str_repl_menu.addAction("Delete All")

        h_layout2 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=0)
        h_layout2.addWidget(create_label("Prefix To Add: ", width=115))
        self._prefix = QtWidgets.QLineEdit()
        h_layout2.addWidget(self._prefix)
        v_layout.addLayout(h_layout2)

        h_layout3 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=0)
        h_layout3.addWidget(create_label("Suffix To Add: ", width=115))
        self._suffix = QtWidgets.QLineEdit()
        h_layout3.addWidget(self._suffix)
        v_layout.addLayout(h_layout3)
Esempio n. 11
0
def create_separator(orientation, size=None):
    line = QtWidgets.QFrame()
    line.setFrameShape(QtWidgets.QFrame.VLine if orientation ==
                       ORIENTATION.VERTICAL else QtWidgets.QFrame.HLine)
    line.setFrameShadow(QtWidgets.QFrame.Sunken)
    if size is not None:
        if orientation == ORIENTATION.VERTICAL:
            line.setFixedHeight(size)
        else:
            line.setFixedWidth(size)
    return line
Esempio n. 12
0
    def _build_preview_and_buttons(self):
        v_layout = create_box_layout(ORIENTATION.VERTICAL, margin=0,
                                      spacing=5)

        v_layout.addSpacing(20)

        self._preview = PreviewWidget(parent=self)
        v_layout.addWidget(self._preview, 0, QtCore.Qt.AlignTop)

        self._import_button = QtWidgets.QPushButton("Import")
        self._import_button.setFixedHeight(75)
        v_layout.addWidget(self._import_button, 1, QtCore.Qt.AlignBottom)

        self._secondary_layout.addLayout(v_layout)
Esempio n. 13
0
    def _build_widgets(self):
        self._build_file()

        self._secondary_layout = create_box_layout(ORIENTATION.HORIZONTAL,
                                                   margin=0, spacing=8)
        self._layout.addLayout(self._secondary_layout)
        self._tab_widget = QtWidgets.QTabWidget(self)
        self._secondary_layout.addWidget(self._tab_widget)

        self._build_tab_import()
        self._build_string()
        self._build_preview_and_buttons()
        self._build_mapping()
        self._build_app_preference_widget()
Esempio n. 14
0
    def _build_image(self):
        self._images_group = QtWidgets.QGroupBox("Images")
        v_layout = create_box_layout(ORIENTATION.VERTICAL, margin=2)
        self._images_group.setLayout(v_layout)

        h_layout = create_box_layout(ORIENTATION.HORIZONTAL, margin=2)
        h_layout.addWidget(create_label("Source: ", width=80))
        self._image_source = QtWidgets.QComboBox()
        h_layout.addWidget(self._image_source)

        v_layout.addLayout(h_layout)

        h_layout = create_box_layout(ORIENTATION.HORIZONTAL, margin=2)
        self._image_frame_range = FrameRange(self)
        h_layout.addWidget(self._image_frame_range)
        h_layout.addWidget(create_separator(ORIENTATION.VERTICAL))
        h_layout.addWidget(create_label("Sample every (frames): ", width=120))
        self._image_sampling = QtWidgets.QLineEdit()
        self._image_sampling.setValidator(QtGui.QDoubleValidator())
        h_layout.addWidget(self._image_sampling)

        v_layout.addLayout(h_layout)

        self._layout.addWidget(self._images_group)
Esempio n. 15
0
    def __init__(self,
                 root=None,
                 show_channels=True,
                 show_chunks=False,
                 parent=None,
                 facade=None):
        super(DataTreeWidget, self).__init__(parent)

        self._show_channels = show_channels
        self._show_chunks = show_chunks

        self._facade = facade

        self._model = DataTreeModel(root=root,
                                    show_channels=show_channels,
                                    show_chunks=show_chunks)
        self._sorting_model = DataTreeSortProxyFilterModel()
        self._sorting_model.setSourceModel(self._model)
        self._sorting_model.setDynamicSortFilter(False)
        self.setModel(self._sorting_model)

        self.header().setSectionsClickable(False)

        self.setColumnWidth(0, 250)

        if self._facade:
            self._menu = QtWidgets.QMenu(self)
            self._sel_item_a = self._menu.addAction("Map To Selected Item")
            self._sel_chan_a = self._menu.addAction("Map To Selected Channel")
            self._unmap_a = self._menu.addAction("Remove Mapping")
            self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
            self.customContextMenuRequested.connect(self._show_menu)
            self._menu.triggered.connect(self._action_triggered)

        if root is not None:
            self.set_root(root)
Esempio n. 16
0
def create_label(text, width=30):
    l = QtWidgets.QLabel(text)
    l.setFixedWidth(width)
    return l
Esempio n. 17
0
    def _build_tab_import(self):
        widget = QtWidgets.QWidget()
        v_layout = create_box_layout(ORIENTATION.VERTICAL, margin=5,
                                     spacing=10)
        widget.setLayout(v_layout)
        self._tab_widget.addTab(widget, "Import")

        v_layout.addSpacing(10)

        self._apply, self._insert, self._replace = create_radio_buttons(
                None, ['Apply', 'Insert', 'Replace'], self, v_layout,
                width=60, add_stretch=False)

        v_layout.addWidget(create_separator(ORIENTATION.HORIZONTAL))

        h_layout1 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=0)
        h_layout1.addSpacing(18)
        h_layout1.addWidget(create_label("Frame value: ", width=116))
        self._frame_value = QtWidgets.QSpinBox(self)
        h_layout1.addWidget(self._frame_value)
        v_layout.addLayout(h_layout1)

        h_layout2 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=5)
        self._enable_frame_range = QtWidgets.QCheckBox("")
        self._enable_frame_range.setFixedWidth(13)
        h_layout2.addWidget(self._enable_frame_range)
        self._frame_range = FrameRange(self, width=111)
        h_layout2.addWidget(self._frame_range)
        v_layout.addLayout(h_layout2)

        self._hierarchy = QtWidgets.QCheckBox("Hierarchy")
        self._hierarchy.setVisible(self._manager.facade.support_hierarchy())
        v_layout.addWidget(self._hierarchy)

        v_layout.addWidget(create_separator(ORIENTATION.HORIZONTAL))

        h_layout3 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=5)
        self._enable_channel_op_priority = QtWidgets.QCheckBox("Channel Op "
                                                               "Priority")
        self._enable_channel_op_priority.setFixedWidth(130)
        h_layout3.addWidget(self._enable_channel_op_priority)
        self._channel_op_priority = QtWidgets.QListWidget(self)
        self._channel_op_priority.setDragDropMode(
            QtWidgets.QAbstractItemView.InternalMove)
        h_layout3.addWidget(self._channel_op_priority)

        v_layout.addLayout(h_layout3)

        h_layout4 = create_box_layout(ORIENTATION.HORIZONTAL, margin=0,
                                      spacing=5)
        self._enable_item_op_priority = QtWidgets.QCheckBox("Item Op Priority")
        self._enable_item_op_priority.setFixedWidth(130)
        h_layout4.addWidget(self._enable_item_op_priority)
        self._item_op_priority = QtWidgets.QListWidget(self)
        self._item_op_priority.setDragDropMode(
            QtWidgets.QAbstractItemView.InternalMove)
        h_layout4.addWidget(self._item_op_priority)

        v_layout.addLayout(h_layout4)

        self._scale_fps = QtWidgets.QCheckBox("Scale FPS")
        v_layout.addWidget(self._scale_fps)
        self._ignore_item_chunks = QtWidgets.QCheckBox("Ignore Item Chunks")
        v_layout.addWidget(self._ignore_item_chunks)

        v_layout.addStretch(1)
Esempio n. 18
0
 def _build_buttons(self):
     self._export_button = QtWidgets.QPushButton("Export")
     self._export_button.setFixedHeight(25)
     self._layout.addWidget(self._export_button)