Example #1
0
 def setUp(self):
     cgtwq.update_setting()
     module = database.Database('proj_big').module('shot')
     select = module.filter(
         cgtwq.Filter('flow_name', '合成') & cgtwq.Filter(
             'shot.shot', ['SNJYW_EP26_06_sc349', 'SNJYW_EP26_06_sc350']))
     assert isinstance(select, cgtwq.Selection)
     if not select:
         raise ValueError('No selection to test.')
     self.assertEqual(len(select), 2)
     self.select = select
Example #2
0
 def setUp(self):
     module = database.Database("proj_sdktest").module("shot")
     select = module.filter(
         cgtwq.Filter("flow_name", "合成")
         & cgtwq.Filter(
             "shot.entity", ["SDKTEST_EP01_01_sc001", "SDKTEST_EP01_01_sc002"]
         )
     )
     assert isinstance(select, cgtwq.Selection)
     if not select:
         raise ValueError("No selection to test.")
     self.assertEqual(len(select), 2)
     self.select = select
Example #3
0
    def __init__(self):
        super(Dialog, self).__init__()
        QtCompat.loadUi(os.path.join(__file__, '../downloader.ui'), self)
        self.file_sets = {}
        self._files = RemoteFiles()
        self.is_downloading = False

        # Recover from config.
        self.dir = CONFIG['OUTPUT_DIR']

        # Setup radio buttons.
        self.radioButtonSubmit.toggled.connect(
            lambda status: self.on_radio_toggled(SUBMIT_FILE, status))
        select = cgtwq.DesktopClient().selection()
        pipeline = select.module.database.pipeline.filter(
            cgtwq.Filter('entity', select['pipeline'][0]))[0]
        for filebox in (
                select.module.database.filebox.list_by_pipeline(pipeline)):
            button = QRadioButton(filebox.title)
            button.setObjectName(filebox.title)
            button.toggled.connect(lambda status, target=filebox: self.
                                   on_radio_toggled(target, status))
            self.groupBox.layout().addWidget(button)

        # Connect signals.
        self.toolButton.clicked.connect(self.ask_dir)
        self.lineEditDir.editingFinished.connect(self.autoset)
        self.checkBoxSkipSame.toggled.connect(self.update_filelist)

        self.update_filelist()
Example #4
0
    def test_getitem(self, select, filter_):
        assert isinstance(select, MagicMock)
        assert isinstance(filter_, MagicMock)
        module = self.module
        select.return_value = filter_.return_value = cgtwq.Selection(module, "random")

        _ = module["abc"]
        select.assert_called_once_with("abc")
        filters = cgtwq.Filter("dce", "fgh")
        _ = module[filters]
        filter_.assert_called_once_with(filters)
Example #5
0
    def test_filter(self):
        module = self.module
        method = self.call_method
        dummy_resp = ["0", "1"]
        method.return_value = dummy_resp

        select = module.filter(cgtwq.Filter("key", "value"))
        method.assert_called_with(
            "c_orm",
            "get_with_filter",
            db="dummy_db",
            module="shot",
            module_type="task",
            sign_array=("task.id",),
            sign_filter_array=[["task.key", "=", "value"]],
            token=select.token,
        )
        self.assertIsInstance(select, cgtwq.Selection)
Example #6
0
def test_in_namespace():
    obj1 = cgtwq.Field("key1")
    obj2 = obj1.in_namespace("namespace1")
    assert obj1 == "key1"
    assert obj2 == "namespace1.key1"

    obj3 = cgtwq.Filter("key2", "value2")
    obj4 = obj3.in_namespace("namespace2")
    assert obj3[0] == "key2"
    assert obj4[0] == "namespace2.key2"

    obj5 = cgtwq.FilterList(obj3)
    obj6 = obj5.in_namespace("namespace3")
    assert obj5[0][0] == "key2"
    assert obj6[0][0] == "namespace3.key2"

    obj7 = cgtwq.FilterList.from_arbitrary_args(obj3, obj4)
    obj8 = obj7.in_namespace("namespace4")
    assert obj7[0][0] == "key2"
    assert obj8[0][0] == "namespace4.key2"
Example #7
0
 def test_get_pipeline(self):
     result = self.database.get_pipelines(cgtwq.Filter('entity_name', '合成'))
     self.assertIsInstance(result[0], database.PipelineInfo)
Example #8
0
 def test_get_filebox(self):
     # filters.
     self.database.get_fileboxes(filters=cgtwq.Filter('title', '检查MOV'))
     # id
     self.database.get_fileboxes(id_='271')
Example #9
0
 def test_get_pipeline(self):
     result = self.database.pipeline.filter(cgtwq.Filter("entity", "合成"))
     self.assertIsInstance(result[0], cgtwq.model.PipelineInfo)
Example #10
0
 def __unicode__(self):
     database = self.module.database
     project = cgtwq.PROJECT.filter(cgtwq.Filter(
         'database', database.name))['full_name'][0]
     return '{}: {}'.format(project, self.shot)