Exemplo n.º 1
0
    def publish(self):
        self.message = str(self.textedit.toPlainText())
        if not self.message:
            QtGui.QMessageBox.warning(self, 'Warning',
                                      'Can not publish with out comment!...',
                                      QtGui.QMessageBox.Ok)
            return
        crowd_publish = crowdPublish.Connect(type=self.type, tag=self.tag)

        # commit
        result, message = crowd_publish.commit()
        if not result:
            QtGui.QMessageBox.warning(self, 'Warning',
                                      'Failed your publis <%s>!...' % message,
                                      QtGui.QMessageBox.Ok)
            self.close()
            return

        crowd_publish.push(extract_bundle=self.extract,
                           comment=self.message,
                           description=self.description,
                           remote=self.scene_name)

        self.close()
        QtGui.QMessageBox.information(self, 'Information',
                                      'Publish Success!...',
                                      QtGui.QMessageBox.Ok)
Exemplo n.º 2
0
 def modify_ui(self):
     publish = crowdPublish.Connect(type=self.type)
     tags = publish.getTags()
     if not tags:
         QtGui.QMessageBox.warning(self, 'Warning',
                                   'Not found any <%s>!...' % (self.type),
                                   QtGui.QMessageBox.Ok)
         return
     self.combobox_input.addItems(tags)
Exemplo n.º 3
0
 def execute_bundle(self, type, bundle, widget, textedit):
     crowd_publish = crowdPublish.Connect(type=self.type)
     result, value, color, data, message = crowd_publish.executeModule(
         bundle)
     if type == 'extract':
         self.global_extract.append([data, message])
     widget.setStyleSheet('Text-align:left; color: {};'.format(color))
     textedit.setText('%s\n#%s\n%s\n%s' %
                      (bundle.__file__, result, message, data))
     self.global_result.append(value)
Exemplo n.º 4
0
 def load_extract(self):
     crowd_publish = crowdPublish.Connect(type=self.type)
     extract_bundles = crowd_publish.getExtract(valid=True)
     if not extract_bundles:
         QtGui.QMessageBox.warning(self, 'Warning',
                                   'Not found any extract bundles',
                                   QtGui.QMessageBox.Ok)
         return
     self.extract_bundles = self.load_buldles('extract', extract_bundles,
                                              self.gridlayout_extract)
Exemplo n.º 5
0
 def modify_ui(self):
     data = resource.getPublishTypes()
     self.combobox_input.addItems(data)
     self.combobox_input.setCurrentIndex(data.index(self.type))
     self.combobox_input.setEnabled(False)
     crowd_publish = crowdPublish.Connect(type=self.type)
     crowd_publish.type = crowd_publish.getDependency()
     tags = crowd_publish.getTags()
     if tags:
         self.combobox_tag.addItems([''] + tags)
Exemplo n.º 6
0
 def load_validate(self):
     crowd_publish = crowdPublish.Connect(type=self.type)
     validator_bundles = crowd_publish.getValidate(valid=True)
     if not validator_bundles:
         QtGui.QMessageBox.warning(self, 'Warning',
                                   'Not found any validate bundles',
                                   QtGui.QMessageBox.Ok)
         return
     self.validate_bundles = self.load_buldles('validate',
                                               validator_bundles,
                                               self.gridlayout_validate)
Exemplo n.º 7
0
    def do(self):
        publish = crowdPublish.Connect(type=self.type, tag=self.tag)
        input_data = publish.getInputs(show=False)

        modules = self.getPackages()
        for order, module in modules.items():
            for each_module in module:
                if not hasattr(each_module, 'MODULE_TYPE'):
                    continue
                if each_module.MODULE_TYPE not in input_data:
                    continue
                print '\t', each_module.MODULE_TYPE
                print '\t', self.tag
                self.executeModule(each_module, self.tag,
                                   input_data[each_module.MODULE_TYPE])
Exemplo n.º 8
0
 def getTags(self):
     publish = crowdPublish.Connect(type='skeleton')
     return publish.getTags()
Exemplo n.º 9
0
    def publish(self):
        self.test_run()
        if False in self.global_result:
            QtGui.QMessageBox.warning(
                self, 'Warning',
                'Can not publish,\nfix the problems and try!...',
                QtGui.QMessageBox.Ok)
            logging.warning('Can not publish, fix the problems and try!...')
            return
        if not self.type:
            self.type = self.combobox_input.currentText()
        if self.type not in resource.getPublishTypes():
            QtGui.QMessageBox.warning(
                self, 'Warning',
                'Can not find publish type called <%s>!...' % self.type,
                QtGui.QMessageBox.Ok)
            logging.warning(
                'Can not find publish type called <%s>!...' % self.type, )
            return
        tag = str(self.combobox_tag.currentText())
        if not tag or tag == '':
            QtGui.QMessageBox.warning(self, 'Warning',
                                      'Can not find name (tag)!...',
                                      QtGui.QMessageBox.Ok)
            logging.warning('Can not find name (tag)!...')
            return

        crowd_publish = crowdPublish.Connect(type=self.type)
        crowd_publish.type = crowd_publish.getDependency()
        dependency_tags = crowd_publish.getTags()

        # to check find dependency publish
        if self.type != crowd_publish.type:
            if tag not in dependency_tags:
                replay = QtGui.QMessageBox.warning(
                    self, 'Warning',
                    'Not found dependency publish called type <%s> tag <%s>' %
                    (crowd_publish.type, tag), QtGui.QMessageBox.Ok)
                return

        crowd_publish.type = self.type
        result = True
        if crowd_publish.isExists(tag):
            replay = QtGui.QMessageBox.question(
                self, 'Question', 'Already exist <%s> in the data base!...%s' %
                (tag, '\nAre you sure to overwrite?...'),
                QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
            if replay == QtGui.QMessageBox.No:
                logging.warning('Abort!...')
                return False

        if not result:
            warnings.warn('Not able to replace exists publish <%s>' % tag,
                          Warning)
            return

        scene_name = str(core.sceneName())
        if not scene_name:
            QtGui.QMessageBox.warning(self, 'Warning',
                                      'Can not save your scene!...',
                                      QtGui.QMessageBox.Ok)
            logging.warning('Can not save your scene!...')
            return

        description = 'This data contain information about <%s> publish' % self.type
        self.comment.type = self.type
        self.comment.tag = tag
        self.comment.description = description
        self.comment.scene_name = scene_name
        self.comment.extract = self.global_extract
        self.comment.show()
        self.close()