Example #1
0
    def __init__(self, session=None, parent=None):

        super(EntityImportWizard, self).__init__(parent=parent)

        self.setModal(True)

        if not session:
            session = SessionRegistry().current()

        self._session = session

        logo_pixmap = QtGui.QPixmap(
            IconFactory().disk_path("icon:///images/icons/import_32x32.png"))

        self.setWindowTitle("Product Import")
        self.setPixmap(QtGui.QWizard.LogoPixmap, logo_pixmap)

        self._query_categories()

        query_id = self.addPage(self.product_query_page)
        selection_id = self.addPage(self.product_selection_page)
        options_id = self.addPage(self.import_options_page)
        confirm_id = self.addPage(self.import_confirm_page)

        self.setOption(QtGui.QWizard.CancelButtonOnLeft, on=True)

        self.product_widget.itemSelectionChanged.connect(self._toggle_options)

        self.setButtonText(QtGui.QWizard.FinishButton, 'Export')

        self.currentIdChanged.connect(self._check_descriptions)
Example #2
0
    def __init__(self, parent=None):

        self._session = SessionRegistry().current()
        if not self._session:
            raise SessionError("Unable to determine current app session.")

        if not parent:
            parent = self._session.main_window

        super(SessionDialog, self).__init__(parent=parent)
Example #3
0
    def get_files(self):
        sublist = defaultdict(dict)

        # for now, get only products available from existing subs with
        # same category
        for sub in SessionRegistry().current().ptask_version.subscriptions:
            prod_ver = sub.product_version
            prod = prod_ver.product

            # this should change if geomentity ever becomes NOT just OBJ
            for sub_rep in prod_ver.representations:
                if prod.category == 'geom':
                    full_path = os.path.join(sub.import_path(), sub_rep.type,
                                             sub_rep.resolution)
                    # actual files wont always be named the same as the
                    # product (eg, maps, so be wary of this)
                    full_path += '/' + prod.name + '.' + sub_rep.type

                    # still don't know if using the spec is the best option
                    sublist[prod.spec] = [full_path, prod.name]

        self._sublist = sublist
Example #4
0
    def __init__(self, session=None, parent=None):

        super(SubscriptionImportWizard, self).__init__(parent=parent)

        self.setModal(True)

        if not session:
            session = SessionRegistry().current()

        self._session = session

        logo_pixmap = QtGui.QPixmap(
            IconFactory().disk_path("icon:///images/icons/import_32x32.png"))

        self.setWindowTitle("Subscription Import")
        self.setPixmap(QtGui.QWizard.LogoPixmap, logo_pixmap)

        # get entity classes
        entity_classes = EntityRegistry().get_entity_classes(
            self.session.app_name)

        # map entity category to class
        self._category_lookup = {}
        for cls in entity_classes:
            self._category_lookup[cls.category] = cls

        selection_id = self.addPage(self.sub_selection_page)
        options_id = self.addPage(self.import_options_page)

        self.setOption(QtGui.QWizard.CancelButtonOnLeft, on=True)
        self.setButtonText(QtGui.QWizard.FinishButton, 'Import')

        self._subs_widget.itemSelectionChanged.connect(self._toggle_options)

        if not self._subs_widget.repr_items: 
            QtGui.QMessageBox.warning(self.parent(), "Import Warning",
                "<b>No subs available to Import</b>."
            )
            self.NO_SUBS = True
Example #5
0
    def __init__(self, session=None, parent=None):

        super(EntityExportWizard, self).__init__(parent=parent)

        self.setModal(True)

        if not session:
            session = SessionRegistry().current()

        self._session = session

        logo_pixmap = QtGui.QPixmap(
            IconFactory().disk_path("icon:///images/icons/export_32x32.png"))

        self.setWindowTitle("Entity Export")
        self.setPixmap(QtGui.QWizard.LogoPixmap, logo_pixmap)

        self._query_entities()

        selection_id = self.addPage(self.entity_selection_page)
        options_id = self.addPage(self.export_options_page)
        confirm_id = self.addPage(self.export_confirm_page)

        self.setOption(QtGui.QWizard.CancelButtonOnLeft, on=True)

        self.entity_widget.itemSelectionChanged.connect(self._toggle_options)

        self.setButtonText(QtGui.QWizard.FinishButton, 'Export')

        self.currentIdChanged.connect(self._check_descriptions)

        if not self.exportable_entities:
            QtGui.QMessageBox.warning(self.parent(), "Export Warning",
                "<b>No entities available to Export</b>. If all entities " + \
                "have been published at this version already, you will " + \
                "need to <b>version up</b> before continuing."
            )
            self.NO_ENTITIES = True
Example #6
0
        """Returns True if inside a current app session."""
        return MARI_IMPORTED or self.remote_connection

    # -------------------------------------------------------------------------
    @property
    def main_window(self):
        """Returns the Qt main window used to parent dialogs/widgets."""

        if not MARI_UI_IMPORTED:
            return None

        if not hasattr(self, '_main_window'):
            self._main_window = QtGui.QWidget()

        return self._main_window

    # -------------------------------------------------------------------------
    @property
    def name(self):
        """Returns the name of the application."""
        return "mari"

    # -------------------------------------------------------------------------
    @property
    def server_executable(self):
        return self.__class__.SERVER_EXECUTABLE


# -----------------------------------------------------------------------------
SessionRegistry().register(MariSession)
Example #7
0
    # -------------------------------------------------------------------------
    @property
    def in_session(self):
        """Returns True if inside a current app session."""
        return HOU_IMPORTED or self.remote_connection

    # -------------------------------------------------------------------------
    @property
    def main_window(self):

        if not HOU_UI_IMPORTED:
            return None

        return QtGui.QApplication.activeWindow()

    # -------------------------------------------------------------------------
    @property
    def name(self):
        """Returns the name of the application."""
        return "houdini"

    # -------------------------------------------------------------------------
    @property
    def server_executable(self):
        return self.__class__.SERVER_EXECUTABLE


# -----------------------------------------------------------------------------
SessionRegistry().register(HoudiniSession)
Example #8
0
        self.nuke.scriptSave(file_path)

    # -------------------------------------------------------------------------
    @property
    def nuke(self):
        return self._nuke

    # -------------------------------------------------------------------------
    @property
    def in_session(self):
        return NUKE_IMPORTED

    # -------------------------------------------------------------------------
    @property
    def main_window(self):

        if not NUKE_HAS_UI:
            return None

        return QtGui.QApplication.activeWindow()

    # -------------------------------------------------------------------------
    @property
    def name(self):
        return self.__class__.app_name


# -----------------------------------------------------------------------------
SessionRegistry().register(NukeSession)
Example #9
0
# -----------------------------------------------------------------------------
class SelectionContext(object):

    def __init__(self, session, selection_list, dependencies=False):
        self._session = session
        self._selection_list = selection_list
        self._dependencies = dependencies

    # ------------------------------------------------------------------------
    def __enter__(self):
        
        # store current selection state
        self._saved_selection = self._session.cmds.ls(selection=True) 

        # select selection list
        self._session.cmds.select(self._selection_list, replace=True,
            allDependencyNodes=self._dependencies)
        
    # ------------------------------------------------------------------------
    def __exit__(self, exc_type, exc_value, traceback):

        # restore selection list
        if self._saved_selection:
            self._session.cmds.select(self._saved_selection, replace=True)

        return False

# -----------------------------------------------------------------------------
SessionRegistry().register(MayaSession)