Exemple #1
0
 def on_accept(self):
     name = self.name_lie.text().strip()
     if len(name) < 3:
         HaocUtils.show_message_box(self,
                                    "Name must at least have 3 letters!")
         return
     set_name_data_state = SCloudUtils.set_user_name(name)
     if set_name_data_state.state != SCloudUtils.ResultDataState.SUCCESS:
         HaocUtils.show_message_box(
             self,
             "Bad Network or something wrong ,fix your network problem and try again!"
         )
     else:
         self.accept()
Exemple #2
0
 def load_asset_in_houdini(self, file_path):
     try:
         hou.clearAllSelected()
         self.pwd_for_load_nodes.loadItemsFromFile(file_path, True)
         with hou.undos.disabler():
             self.move_nodes_to_clicked_position(hou.selectedItems(),
                                                 self.pos_for_load_nodes)
     except hou.PermissionError as e:
         HaocUtils.show_message_box(self, e.instanceMessage())
     except hou.OperationFailed as e:
         HaocUtils.show_message_box(self, e.description())
         # If load failed it can be the asset damaged, so make it size 0 for nex time download
         open(file_path, 'w').close()
     except hou.LoadWarning as e:
         print e.description()
Exemple #3
0
    def on_login(self):
        access_key = self.access_key_lie.text().strip()
        secret_key = self.secret_key_lie.text().strip()
        if access_key == '' or secret_key == '':
            HaocUtils.show_message_box(
                self, "Please complete the necessary information!")
            return
        login_data_state = SCloudUtils.login_cloud(access_key, secret_key)
        if login_data_state.state != SCloudUtils.ResultDataState.SUCCESS:
            if login_data_state.state == SCloudUtils.ResultDataState.ACCESS_KEY_ERROR:
                HaocUtils.show_message_box(self, "AccessKey is not exist!")
                return
            elif login_data_state.state == SCloudUtils.ResultDataState.SECRET_KEY_ERROR:
                HaocUtils.show_message_box(self, "SecretKey is incorrect")
                return
            elif login_data_state.state == SCloudUtils.ResultDataState.BAD_NETWORK:
                HaocUtils.show_message_box(
                    self,
                    "Bad Network or something wrong ,fix your network problem and try again!"
                )
                return
            else:
                HaocUtils.show_message_box(self, "Unknown error!")
                return
        # Login success
        else:
            user_name = None
            data_state = SCloudUtils.get_user_name()
            if data_state.state != SCloudUtils.ResultDataState.SUCCESS:
                # If there is no name make one
                if data_state.state == SCloudUtils.ResultDataState.TARGET_NOT_FOUND:
                    make_name_w = MakeNameWidget(self)
                    # make_name_w.setParent(self, QtCore.Qt.Dialog)
                    make_name_w.setWindowFlags(QtCore.Qt.Dialog)
                    if make_name_w.exec_():
                        user_name = make_name_w.get_name().strip()
                    else:
                        return
                else:
                    HaocUtils.show_message_box(
                        self,
                        "Bad Network or something wrong ,fix your network problem and try again!"
                    )
            # Already has a name just get it
            else:
                user_name = data_state.data

            data = HaocUtils.Config(access_key, secret_key, user_name)
            data.save()

            asset_manage_widget = AssetMangeWidget(user_name)
            asset_manage_widget.setStyleSheet(self.styleSheet())
            asset_manage_widget.move(self.pos())
            asset_manage_widget.show()

            HaocEventFilter.HaocEventF.installHaocEventF()
            HaocUtils.is_login = True
            self.close()