def __init__(self, *args, **kwargs): """ Flags: - parent: p (QMainWindow, default:Wrapped Maya main window) The parent layout for this control. """ # Get the maya main window as a QMainWindow instance. parent = kwargs.pop('p', kwargs.pop('parent', sip.wrapinstance(long(mui.MQtUtil.mainWindow()), QObject))) super(QMainWindow, self).__init__(parent) # uic adds a function to our class called setupUi, calling this creates all the # widgets from the .ui file. self.setupUi(self) self.__name__ = self.__class__.__name__ g_name = 'g%sDocker' % self.__name__ melGlobals.initVar('string', g_name) docker = melGlobals[g_name] if docker and dockControl(docker, exists=True): info('Deleting docker: ' + docker) deleteUI(docker, control=True) docker = dockControl(allowedArea=['left', 'right'], area='right', floating=False, content=self.__name__, parent='MayaWindow|formLayout1', label=str(self.windowTitle()), width=self.width()) melGlobals[g_name] = docker.split('|')[-1]
def _dock_closed(s, *loop): visible = s._dock_query(vis=True) if not visible and loop: pmc.scriptJob(ie=s._dock_closed, p=s._dock, ro=True) elif not visible: pmw.deleteUI(s._dock, control=True) print "Window closed."
def populateProjectsList(self, _filter=[]): #This is where we populate our drop down menu. So its just GUI stuff #Get all the current menu items for the project drop down menu, if there are any menuItems = windows.optionMenu("projectOptionMenu", q = True, ill = True) #If theres at least one, delete it. In the future, this will have to be replaced by a more #Elegant function that simply checks each one against the new list being added and only #Adds new ones when necessary and deletes old ones, rather than rebuilding the entire menu if len(menuItems)>0: windows.deleteUI(menuItems) #If the list of projects actually has something in it... if len(self.projects)>0: #...iterate through the projects and create a menu option for each one. for project in self.projects: if len(_filter)>0: for f in _filter: if project.make == f: windows.menuItem(l = project.numname, p = "projectOptionMenu") break else: windows.menuItem(l = project.numname, p = "projectOptionMenu") if len(windows.optionMenu("projectOptionMenu", q = True, ill = True))==0: windows.menuItem(l = "None", p = "projectOptionMenu") else: self.populatePartsList() else: #If no projects are found, just add a None menu option. windows.menuItem(l = "None", p = "projectOptionMenu")
def waffleCutterGUI(self): ##Check if the window exists, if it does, delete it, otherwise / afterwards, create it if windows.window("waffleCutterWindow", exists=True): windows.deleteUI("waffleCutterWindow") windows.window("waffleCutterWindow", t = "Waffle Cutter", sizeable = False, w = 300, h = 200) windows.columnLayout() #Overall column layout ##MORE COLUMN LAYOUT CONTROLS HERE ## windows.frameLayout("waffleCutterGizmos", l = "Waffle Cutter Gizmo", w = 300) windows.rowLayout(nc = 3) windows.iconTextButton("createGizmoButton", style = "iconAndTextVertical", l = "Create Gizmo", image1 = "menuIconModify.png", c = lambda: self.createGizmo()) windows.iconTextButton("deleteGizmoButton", style = "iconAndTextVertical", l = "Delete Gizmo", image1 = "menuIconModify.png", c = lambda: self.deleteGizmo()) windows.iconTextButton("alignGizmoButton", style = "iconAndTextVertical", l = "Align to Camera", image1 = "menuIconModify.png", c = lambda: self.alignToCamera()) windows.setParent(u = True) windows.setParent(u = True) #windows.separator(h = 10, w = 300, style = "in") windows.frameLayout("waffleCutterSettings", l = "Waffle Cutter Settings", w = 300) windows.columnLayout() windows.floatSliderGrp("stepSizeSlider", l = "Step Size", field = True, cw3 = (80, 30, 150), min = 0.1, max = 100, v = 5) windows.floatSliderGrp("stepCountSlider", l = "Step Count", field = True, cw3 = (80, 30, 150), min = 5, max = 200, v = 100, pre = 0) windows.radioButtonGrp("axesRadioButtonGrp", nrb = 3, l = "Axes", labelArray3 = ["X", "Y", "Both"], cw4 = [80,50,50,50], sl = 3) windows.setParent(u = True) windows.setParent(u = True) ##MORE COLUMN LAYOUT CONTROLS HERE ## windows.button("waffleSliceButton", l = "Waffle Slice", h = 50, w = 300, c = lambda event: self.performSlice()) windows.setParent(u = True) #Show the window windows.showWindow("waffleCutterWindow")
def __init__(self): waitfor("""osascript -e 'mount volume "afp://xserve1._afpovertcp._tcp.local/Client_Projects"'""", 30) waitfor("""osascript -e 'mount volume "afp://xserve1._afpovertcp._tcp.local/bto-secure"'""", 30) if windows.window("fileSaver_GUI", exists=True): windows.deleteUI("fileSaver_GUI") if windows.window("loadingWindow", exists=True): windows.deleteUI("loadingWindow") if windows.window("fileSaver_SaveGUI", exists = True): windows.deleteUI("fileSaver_SaveGUI") windows.window("loadingWindow", h = 20, sizeable=False, t = "Loading Projects") windows.columnLayout() windows.separator(h=20) windows.rowLayout(nc = 3) windows.separator(w=10, st = "none") windows.text(l = "One moment, finding projects...") windows.separator(w=10, st = "none") windows.setParent(u = True) windows.separator(h=20) windows.showWindow("loadingWindow") #time.sleep(0.1) self.initializeVars() windows.deleteUI("loadingWindow") self.GUI() self.loadSettings()
def show_window(cls, refresh=False): cls.load_pref() _window_name = 'CGTeamWork' _all_textfiled = {} _labels = { #'SERVER': u'服务器路径', 'DATABASE': u'项目数据库', 'ASSET_MODULE': u'资产模块名', 'SHOT_TASK_MODULE': u'镜头制作模块名', 'PIPELINE': u'环节' } if window(_window_name, exists=True): if refresh: deleteUI(_window_name) else: showWindow(_window_name) return True win = window(_window_name, sizeable=False) columnLayout(columnAttach=('both', 5), adjustableColumn=True) rowColumnLayout(numberOfColumns=2, columnAttach=(1, 'right', 1), columnWidth=[(1, 100), (2, 250)]) for _key in _labels.keys(): if _key in cls.config.keys(): text(label=_labels[_key]) _all_textfiled[_key] = textField(_key, text=cls.config[_key]) setParent('..') rowLayout(numberOfColumns=2, adjustableColumn=1) def _ok_button_pressed(*args): for _key in _all_textfiled.keys(): cls.config[_key] = TextField(_all_textfiled[_key]).getText() cls.save_pref() win.delete() _ok = button(label='ok', command=_ok_button_pressed) def _reset_button_pressed(*args): cls.config.update(cls.__config) cls.save_pref() win.delete() cls.show_window() _reset = button(label=u'重置', width=80, command=_reset_button_pressed) raise RuntimeError(win) win.show() return win
def populatePartsList(self): #First query whether or not we have a valid project selected. Otherwise theres no point #in trying to query the parts list, since its derivative of the project directory if windows.optionMenu("projectOptionMenu", q = True, v = True)=="None": #Delete all menu items and create a "None" item if there is none [windows.deleteUI(x) for x in windows.optionMenu("partOptionMenu", q = True, ill = True)] windows.menuItem(l = "None", p = "partOptionMenu") else: project = self.getSelectedProject() #Delete all the menu items in the part option menu dropdown [windows.deleteUI(x) for x in windows.optionMenu("partOptionMenu", q = True, ill = True)] if len(project.modelingComponents)>0: [windows.menuItem(l = component[2], p = "partOptionMenu") for component in project.modelingComponents] else: windows.menuItem(l = "None", p = "partOptionMenu")
def __init__(self): waitfor("""osascript -e 'mount volume "afp://xserve1._afpovertcp._tcp.local/Test01"'""", 30) waitfor("""osascript -e 'mount volume "afp://xserve1._afpovertcp._tcp.local/Test02"'""", 30) if windows.window("GUIWindow", exists=True): windows.deleteUI("GUIWindow") if windows.window("loadingWindow", exists=True): windows.deleteUI("loadingWindow") windows.window("loadingWindow", w=300, h=150, sizeable=False, t = "Loading Projects") windows.columnLayout() windows.separator(h=20) windows.rowLayout(nc = 3) windows.separator(w=10, st = "none") windows.text(l = "One moment, finding projects...") windows.separator(w=10, st = "none") windows.setParent(u = True) windows.separator(h=20) windows.showWindow("loadingWindow") time.sleep(2) self.initializeVars() windows.deleteUI("loadingWindow") self.GUI() self.loadSettings()