def test_get_frame_range(self):
        with Stub() as pymel.core.general:
            from pymel.core.general import SCENE

            SCENE.defaultRenderGlobals.startFrame.get() >> 10.0
            SCENE.defaultRenderGlobals.endFrame.get() >> 42.0
        frange = get_frame_range()
        self.assertEqual(frange[0], 10)
        self.assertEqual(frange[1], 42)
        for val in frange:
            self.assertTrue(isinstance(val, int))
Example #2
0
        def create(self):
            """
            Generates a new maya window object and binds it to the singleton 
            instance.
            """
            SCENE = Scene()
            self._win = window(title=self.window_title, 
                               resizeToFitChildren=True)
            with self._win:
                template = uiTemplate('LocalSubmitTemplate', force=True )
                template.define(frameLayout, bs='etchedIn', mw=6, mh=6, 
                                labelVisible=False)
                template.define(columnLayout, adj=True, rs=4)
                template.define(formLayout, nd=100)
                # padding adjustment for pre-qt maya versions
                if versions.current() <= versions.v2010:
                    template.define(text, align='right', h=22)
                else:
                    template.define(text, align='right', h=20)
                with template:
                    with formLayout() as mainForm:
                        with frameLayout() as setFrame:
                            with formLayout() as setForm:
                                with columnLayout() as setCol1:
                                    text(label="Title:")
                                    text(label="Start Frame:")
                                    text(label="End Frame:")
                                    text(label="Frame Step:")
                                    text(label="Emulation:", annotation='If selected, the local render will behave in the same environtment as the Cluster, otherwise it will act as a normal local batch render')
                                with columnLayout() as setCol2:
                                    self._controls['title'] = textField(text=get_scene_name())
                                    self._controls['start'] = intField(value=get_frame_range()[0])
                                    self._controls['end'] = intField(value=get_frame_range()[1])
                                    self._controls['step'] = intField(value=int(SCENE.defaultRenderGlobals.byFrameStep.get()))
                                    self._controls['emulate'] = checkBox(label="Cluster Emulation", annotation='If selected, the local render will behave in the same environtment as the Cluster, otherwise it will act as a normal local batch render')
                                    self._controls['pause'] = checkBox(label="Pause before exit")
#                                    self._controls['debug'] = checkBox(label="Show debug messages")
                            
                            setForm.attachForm(setCol1, 'left', 4)
                            setForm.attachControl(setCol1, 'right', 2, setCol2)
                            setForm.attachForm(setCol2, 'right', 4)
                            setForm.attachPosition(setCol2, 'left', 40, 20)
                            
                        with frameLayout() as subFrame:
                            submit_btn = button(label="Submit", width=200, height=40, align='center')
                            submit_btn.setCommand(self.submit_job)
                    
                    mainForm.attachForm(setFrame, 'top', 4)
                    mainForm.attachForm(setFrame, 'left', 4)
                    mainForm.attachForm(setFrame, 'right', 4)
                    mainForm.attachControl(setFrame, 'bottom', 4, subFrame)
                    mainForm.attachForm(subFrame, 'bottom', 4)
                    mainForm.attachForm(subFrame, 'left', 4)
                    mainForm.attachForm(subFrame, 'right', 4)
                    
                    """
                    We force the closure of an open submit window on scene open 
                    to ensure the new scene's settings are reflected.
                    """
                    scriptJob(parent=self._win, runOnce=True, 
                              event=('SceneOpened', SubmitGui.destroy))
Example #3
0
        def create(self):
            """
            Generates a new maya window object and binds it to the singleton 
            instance.
            """
            SCENE = Scene()
            self._win = window(title=self.window_title, 
                               resizeToFitChildren=True)
            with self._win:
                template = uiTemplate('HpcSubmitTemplate', force=True )
                template.define(frameLayout, bs='etchedIn', mw=6, mh=6, 
                                labelVisible=False)
                template.define(columnLayout, adj=True, rs=4)
                template.define(formLayout, nd=100)
                # padding adjustment for pre-qt maya versions
                if versions.current() <= versions.v2010:
                    template.define(text, align='right', h=22)
                else:
                    template.define(text, align='right', h=20)
                with template:
                    with formLayout() as mainForm:
                        with frameLayout() as setFrame:
                            with formLayout() as setForm:
                                with columnLayout() as setCol1:
                                    text(label="Head Node:")
                                    text(label="Title:")
                                    text(label="Start Frame:")
                                    text(label="End Frame:")
                                    text(label="Frame Step:")
#                                    text(label="Cores:")
                                with columnLayout() as setCol2:
                                    self._controls['head_node'] = optionMenu()
                                    with self._controls['head_node']:
                                        for host in HEAD_NODES: 
                                            menuItem(label=host)
                                        self._controls['head_node'].setSelect(randint(1,len(HEAD_NODES)))
                                    self._controls['title'] = textField(text=get_scene_name())
                                    self._controls['start'] = intField(value=get_frame_range()[0])
                                    self._controls['end'] = intField(value=get_frame_range()[1])
                                    self._controls['step'] = intField(value=int(SCENE.defaultRenderGlobals.byFrameStep.get()))
                                    
#                                    with columnLayout(adj=False):
#                                        self._controls['threads'] = optionMenu(w=40)
#                                        with self._controls['threads']:
#                                            menuItem(label=2)
#                                            menuItem(label=4)
#                                        self._controls['threads'].setSelect(1)
                                    self._controls['pause'] = checkBox(label="Pause before exit")
                                    self._controls['debug'] = checkBox(label="Show debug messages")
                            
                            setForm.attachForm(setCol1, 'left', 4)
                            setForm.attachControl(setCol1, 'right', 2, setCol2)
                            setForm.attachForm(setCol2, 'right', 4)
                            setForm.attachPosition(setCol2, 'left', 40, 20)
                            
                        with frameLayout() as subFrame:
                            submit_btn = button(label="Submit", width=200, height=40, align='center')
                            submit_btn.setCommand(self.submit_job)
                    
                    mainForm.attachForm(setFrame, 'top', 4)
                    mainForm.attachForm(setFrame, 'left', 4)
                    mainForm.attachForm(setFrame, 'right', 4)
                    mainForm.attachControl(setFrame, 'bottom', 4, subFrame)
                    mainForm.attachForm(subFrame, 'bottom', 4)
                    mainForm.attachForm(subFrame, 'left', 4)
                    mainForm.attachForm(subFrame, 'right', 4)
                    
                    """
                    We force the closure of an open submit window on scene open 
                    to ensure the new scene's settings are reflected.
                    """
                    scriptJob(parent=self._win, runOnce=True, 
                              event=('SceneOpened', SubmitGui.destroy))