Пример #1
0
    def doSnap(self):
        desktop = QtGui.QApplication.desktop()
        deskrect = desktop.screenGeometry()
        self.showMinimized()
        time.sleep(1)
        pic = QtGui.QPixmap.grabWindow(desktop.winId(), 0, 0, deskrect.width(), deskrect.height())
        
        self.showNormal()
        self.snap_dialog = PPSnap(pic, self)
        self.snap_dialog.showFullScreen()

        if self.snap_dialog.exec_() == QtGui.QDialog.Accepted:
            if self.snap_dialog.out_image:
                save_file = QtGui.QFileDialog.getSaveFileName()
                self.snap_dialog.out_image.save(save_file)
                return True
Пример #2
0
    def doAddThumbToSelAsset(self):
        asset = self.network_editor.getAsset()
        thumb = asset.thumbFile()

        desktop = QtGui.QApplication.desktop()
        deskrect = desktop.screenGeometry()
        self.showMinimized()
        time.sleep(1)
        pic = QtGui.QPixmap.grabWindow(desktop.winId(), 0, 0, deskrect.width(), deskrect.height())
        
        self.showNormal()
        self.snap_dialog = PPSnap(pic, self)
        self.snap_dialog.showFullScreen()

        if self.snap_dialog.exec_() == QtGui.QDialog.Accepted:
            if self.snap_dialog.out_image:
                self.snap_dialog.out_image.save(thumb)
                asset.setThumb()
                return True
Пример #3
0
class MangoMainWindow(QtGui.QMainWindow):
    def __init__(self, parent = None):
        QtGui.QMainWindow.__init__(self, parent)
        self.setWindowTitle("Mango 1.0")
        self.resize(1027, 768)
        self.home = os.path.join(os.path.expanduser('~'), "Mango")
        if not os.path.isdir(self.home):
            os.makedirs(self.home)

        self.menubar = self.menuBar()
        self.createToolBar()
        self.createAssetCmds()
        self.createToolsCmds()
        self.createHelpCmds()

        self.initCentralWidget()
        self.initDockWidget()
        self.createEditors()

        self.statusbar = self.statusBar()
        self.initData()
        self.doConnectToServer()

    def initData(self):
        self.engine = PEngine(home = self.home)
        self.doc_dialog = None

    def createAssetCmds(self):
        # actions of asset
        self.actConnectToServer = QtGui.QAction(QtGui.QIcon(psource.icon_connect_to_server), u"连接到任务管理系统", self)
        
        self.actAddThumbToSelAsset = QtGui.QAction(QtGui.QIcon(psource.icon_add_thumb), u"添加缩略图", self)
        self.actShowAssetInExplorer = QtGui.QAction(QtGui.QIcon(psource.icon_show_in_explorer), u"在浏览器中打开资产", self)
        self.actCreateOnDisk = QtGui.QAction(QtGui.QIcon(psource.icon_show_in_explorer), u"在硬盘中创建", self)
        self.actGoto = QtGui.QAction(QtGui.QIcon(psource.icon_goto), u"Goto", self)
        self.actGoto.setShortcut(QtGui.QKeySequence("g"))
        self.actPublish = QtGui.QAction(QtGui.QIcon(psource.icon_publish), u"发布", self)
        self.actPublish.setShortcut(QtGui.QKeySequence("p"))
        
        self.actSetting = QtGui.QAction(u"设置", self)
        ## Menu Asset:
        self.menuAsset = QtGui.QMenu(u"资产", self)
        self.menuAsset.addAction(self.actConnectToServer)
        self.menuAsset.addSeparator()
        self.menuAsset.addAction(self.actAddThumbToSelAsset)
        self.menuAsset.addAction(self.actShowAssetInExplorer)
        self.menuAsset.addAction(self.actCreateOnDisk)
        self.menuAsset.addSeparator()
        self.menuAsset.addAction(self.actGoto)
        self.menuAsset.addAction(self.actPublish)
        self.menuAsset.addSeparator()
        self.menuAsset.addAction(self.actSetting)

        self.mainToolbar.addAction(self.actConnectToServer)
        self.mainToolbar.addAction(self.actAddThumbToSelAsset)
        self.mainToolbar.addAction(self.actShowAssetInExplorer)
        self.mainToolbar.addAction(self.actGoto)
        self.mainToolbar.addAction(self.actPublish)

        self.connect(self.actConnectToServer, QtCore.SIGNAL('triggered()'), self.doConnectToServer)
        self.connect(self.actAddThumbToSelAsset, QtCore.SIGNAL('triggered()'), self.doAddThumbToSelAsset)
        self.connect(self.actShowAssetInExplorer, QtCore.SIGNAL('triggered()'), self.doShowAssetInExplorer)
        self.connect(self.actCreateOnDisk, QtCore.SIGNAL('triggered()'), self.doCreateOnDisk)
        self.connect(self.actGoto, QtCore.SIGNAL('triggered()'), self.doGoto)
        self.connect(self.actPublish, QtCore.SIGNAL('triggered()'), self.doPublish)
        self.connect(self.actSetting, QtCore.SIGNAL('triggered()'), self.doSetting)

        self.menubar.addMenu(self.menuAsset)

    def createToolsCmds(self):
        # actions of tools
        self.actSnapTool = QtGui.QAction(u"截图", self)
        ## Menu Tools
        self.menuTools = QtGui.QMenu(u"工具", self)
        self.menuTools.addAction(self.actSnapTool)

        self.connect(self.actSnapTool, QtCore.SIGNAL('triggered()'), self.doSnap)

        self.menubar.addMenu(self.menuTools)

    def createHelpCmds(self):
        # actions of help
        self.actDocumentation = QtGui.QAction(u"文档", self)
        self.actAbout = QtGui.QAction(u"关于AssetMG", self)
        ## Menu Help:
        self.menuHelp = QtGui.QMenu(u"帮助", self)
        self.menuHelp.addAction(self.actDocumentation)
        self.menuHelp.addAction(self.actAbout)
        ## Menu Help:
        self.connect(self.actDocumentation, QtCore.SIGNAL('triggered()'), self.doDocumentation)
        self.connect(self.actAbout, QtCore.SIGNAL('triggered()'), self.doAbout)

        self.menubar.addMenu(self.menuHelp)

    def showMSG(self, msg):
        self.statusbar.showMessage(msg)

    def createToolBar(self):
        self.mainToolbar = QtGui.QToolBar('Asset Tools')
        self.mainToolbar.setAllowedAreas(QtCore.Qt.AllToolBarAreas)
        # self.mainToolbar.setOrientation(QtCore.Qt.Horizontal)
        self.mainToolbar.setOrientation(QtCore.Qt.Vertical)
        self.addToolBar(QtCore.Qt.LeftToolBarArea, self.mainToolbar)
    
    def initCentralWidget(self):
        self.main_pane = Pane()
        self.setCentralWidget(self.main_pane)
    
    def createEditors(self):
        self.network_editor = NetworkEditor()
        self.connect(self.network_editor, QtCore.SIGNAL('goin'), self.goin)
        self.connect(self.network_editor, QtCore.SIGNAL('gout'), self.gout)
        self.connect(self.network_editor, QtCore.SIGNAL('gotoproject'), self.setProject)
        self.main_pane.addTab(self.network_editor, self.network_editor.name)

    def initDockWidget(self):
        self.houtini_tool = htools.HTools()
        self.houdini_tool_dock = QtGui.QDockWidget(u"HTools", self)
        # self.houdini_tool_dock.setMinimumWidth(150)
        self.houdini_tool_dock.setAllowedAreas(QtCore.Qt.RightDockWidgetArea)
        self.houdini_tool_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
        self.houdini_tool_dock.setFloating(False)
        self.houdini_tool_dock.setWidget(self.houtini_tool)
        self.houdini_tool_dock.setVisible(True)
        
        self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.houdini_tool_dock)

    # ------------------------------------------------------------------------------------------
    #
    # ------------------------------------------------------------------------------------------
    def goin(self, a_id, name):
        self.engine.goin(a_id, name)
        self.network_editor.showAssets(self.engine.assets)
        self.network_editor.showPath(self.engine.getGoPath())
        return True

    def gout(self):
        self.engine.gout()
        self.network_editor.showAssets(self.engine.assets)
        self.network_editor.showPath(self.engine.getGoPath())
        return True

    def setProject(self, proj):
        self.engine.setProject(proj)

    def doConnectToServer(self):
        login_dialog = LoginDialog()
        login_dialog.setInfo(self.engine.toDict())
        if login_dialog.exec_() == QtGui.QDialog.Accepted:
            info = login_dialog.getInfo()
            self.engine.web_server = info['server']
            self.engine.web_port = info['port']
            self.engine.user = info['user']
            self.engine.password = info['password']
            self.engine.connectToWeb()
            self.engine.goin('/', '/')
            self.network_editor.showAssets(self.engine.assets)
            self.network_editor.showPath(self.engine.getGoPath())
            self.showMSG(u"登陆成功,欢迎 %s" % info['user'])
            return True
        else:
            return False

    def doSetting(self):
        set_dialog = SettingDialog()
        set_dialog.setInfo(self.engine.toDict())
        if set_dialog.exec_() == QtGui.QDialog.Accepted:
            info = set_dialog.getInfo()
            self.engine.fromDict(info)
            self.engine.write()
            self.hbridge.fromDict(info)
            self.hbridge.write()
            self.mbridge.fromDict(info)
            self.mbridge.write()
            self.showMSG(u"设置成功")
            return True
        else:
            return False

    def doAddThumbToSelAsset(self):
        asset = self.network_editor.getSelectAsset()
        if not asset:
            self.showMSG(u"请选择一个资产")
            return False
        thumb = asset.thumbFile()

        desktop = QtGui.QApplication.desktop()
        deskrect = desktop.screenGeometry()
        self.showMinimized()
        time.sleep(1)
        pic = QtGui.QPixmap.grabWindow(desktop.winId(), 0, 0, deskrect.width(), deskrect.height())
        
        self.showNormal()
        self.snap_dialog = PPSnap(pic, self)
        self.snap_dialog.showFullScreen()

        if self.snap_dialog.exec_() == QtGui.QDialog.Accepted:
            if self.snap_dialog.out_image:
                self.snap_dialog.out_image.save(thumb)
                self.network_editor.select_item.setThumb()
                return True
    
    def doShowAssetInExplorer(self):
        asset = self.network_editor.getSelectAsset()
        if not asset:
            self.showMSG(u"请选择一个资产")
            return False

        asset_location = asset.path
        if os.path.isdir(asset_location):
            os.system("start explorer /root,%s" % string.replace(asset_location, "/", "\\"))
            return True
        else:
            self.showMSG(u"资产还没有发布")
            return False
        
    def doCreateOnDisk(self):
        asset = self.network_editor.getSelectAsset()
        if not asset:
            self.showMSG(u"请选择一个资产")
            return False

        asset_location = asset.path
        if not os.path.isdir(asset_location):
            os.makedirs(asset_location)
        asset.write()

    def doGoto(self):
        asset = self.network_editor.getSelectAsset()
        if not asset:
            self.showMSG(u"请选择一个资产")
            return False
        # workspace = self.engine.pubToJob(asset.path)
        workspace = asset.path
        os.environ['PROJECT'] = self.engine.project
        os.environ['JOB'] = self.engine.project_path
        if asset.parent:
            os.environ['ASSET'] = asset.parent
        else:
            os.environ['ASSET'] = asset.name

        os.environ['ASSETPATH'] = asset.path
        if os.name == "nt":
            if not os.path.isdir(workspace):
                os.makedirs(workspace)
            os.chdir(workspace)
            os.system('start cmd')
            return True
        elif os.name == "posix":
            return True

    def doPublish(self):
        asset = self.network_editor.getSelectAsset()
        if not asset:
            self.showMSG(u"请选择一个资产")
            return False

        goal_dir = self.engine.cutPubHeader(asset.getPublishPath())
        
        publish_dialog = PublishDialog()
        info = {}
        info['asset'] = asset.name
        info['version'] = asset.version
        info['author'] = self.engine.user
        info['pub_to'] = goal_dir
        publish_dialog.setInfo(info)
        publish_dialog.start_dir = self.engine.pubToJob(asset.path)

        if publish_dialog.exec_() == QtGui.QDialog.Accepted:
            info = publish_dialog.getInfo()
            pub_files = publish_dialog.getFiles(self.engine.job)
            self.engine.publish(asset.asset_id, info['qc'], pub_files, goal_dir)
            QtGui.QMessageBox.about(self, u"完成", u"发布成功")
            return True
   
    # tool functions
    def doSnap(self):
        desktop = QtGui.QApplication.desktop()
        deskrect = desktop.screenGeometry()
        self.showMinimized()
        time.sleep(1)
        pic = QtGui.QPixmap.grabWindow(desktop.winId(), 0, 0, deskrect.width(), deskrect.height())
        
        self.showNormal()
        self.snap_dialog = PPSnap(pic, self)
        self.snap_dialog.showFullScreen()

        if self.snap_dialog.exec_() == QtGui.QDialog.Accepted:
            if self.snap_dialog.out_image:
                save_file = QtGui.QFileDialog.getSaveFileName()
                self.snap_dialog.out_image.save(save_file)
                return True

    # help functions
    def doDocumentation(self):
        if not self.doc_dialog:
            self.doc_dialog = DocDialog(self)
            f = open(psource.doc_file, 'r')
            docu = f.read()
            f.close()
            self.doc_dialog.showDoc(docu.decode('utf-8'))

        self.doc_dialog.show()

    def doAbout(self):
        QtGui.QMessageBox.about(self, "About", "Develop by Kun.Wang\nCopyright Pillars CG Technology.\n2013.01.01")
Пример #4
0
class MangoMainWindow(QtGui.QMainWindow):
    def __init__(self, home, parent = None):
        QtGui.QMainWindow.__init__(self, parent)
        self.setWindowTitle("Mango 1.0")
        self.resize(1027, 768)
        self.home = home

        self.menubar = self.menuBar()
        self.createToolBar()
        self.createAssetCmds()
        self.createMayaCmds()
        self.createHoudiniCmds()
        self.createToolsCmds()
        self.createHelpCmds()

        self.initCentralWidget()
        self.initDockWidget()
        self.createEditors()

        self.statusbar = self.statusBar()
        self.initData()
        self.doConnectToServer()

    def initData(self):
        self.webbridge = WebBridge(home = self.home)
        self.doc_dialog = None
        self.setting = MangoSetting(self.home)
        self.go = []
        self.go_path = []
        self.go_path.append(self.setting.getProjectPubPath())

    def createAssetCmds(self):
        # actions of asset
        self.actConnectToServer = QtGui.QAction(QtGui.QIcon(psource.icon_connect_to_server), u"连接到任务管理系统", self)
        
        self.actAddThumbToSelAsset = QtGui.QAction(QtGui.QIcon(psource.icon_add_thumb), u"添加缩略图", self)
        self.actShowAssetInExplorer = QtGui.QAction(QtGui.QIcon(psource.icon_show_in_explorer), u"在浏览器中打开资产", self)
        self.actGoto = QtGui.QAction(QtGui.QIcon(psource.icon_goto), u"Goto", self)
        self.actGoto.setShortcut(QtGui.QKeySequence("g"))
        self.actPublish = QtGui.QAction(QtGui.QIcon(psource.icon_publish), u"发布", self)
        self.actPublish.setShortcut(QtGui.QKeySequence("p"))
        
        self.actSetting = QtGui.QAction(u"设置", self)
        ## Menu Asset:
        self.menuAsset = QtGui.QMenu(u"资产", self)
        self.menuAsset.addAction(self.actConnectToServer)
        self.menuAsset.addSeparator()
        self.menuAsset.addAction(self.actAddThumbToSelAsset)
        self.menuAsset.addAction(self.actShowAssetInExplorer)
        self.menuAsset.addSeparator()
        self.menuAsset.addAction(self.actGoto)
        self.menuAsset.addAction(self.actPublish)
        self.menuAsset.addSeparator()
        self.menuAsset.addAction(self.actSetting)

        self.mainToolbar.addAction(self.actConnectToServer)
        self.mainToolbar.addAction(self.actAddThumbToSelAsset)
        self.mainToolbar.addAction(self.actShowAssetInExplorer)
        self.mainToolbar.addAction(self.actGoto)
        self.mainToolbar.addAction(self.actPublish)

        self.connect(self.actConnectToServer, QtCore.SIGNAL('triggered()'), self.doConnectToServer)
        self.connect(self.actAddThumbToSelAsset, QtCore.SIGNAL('triggered()'), self.doAddThumbToSelAsset)
        self.connect(self.actShowAssetInExplorer, QtCore.SIGNAL('triggered()'), self.doShowAssetInExplorer)
        self.connect(self.actGoto, QtCore.SIGNAL('triggered()'), self.doGoto)
        self.connect(self.actPublish, QtCore.SIGNAL('triggered()'), self.doPublish)
        self.connect(self.actSetting, QtCore.SIGNAL('triggered()'), self.doSetting)

        self.menubar.addMenu(self.menuAsset)

    def createMayaCmds(self):
        # actions of maya
        self.actConnectToMaya = QtGui.QAction(u"连接到Maya", self)
        self.actConnectToRemoteMaya = QtGui.QAction(u"连接到远程Maya", self)
        self.actDisConnectToMaya = QtGui.QAction(u"断开连接", self)
        self.actSendSelToMaya = QtGui.QAction(u"发送到 Maya", self)
        self.actSendSelToMaya.setShortcut(QtGui.QKeySequence("m"))
        self.actInstallMayaPlugin = QtGui.QAction(u"安装Maya插件", self)
        ## Menu Maya     
        self.menuMaya = QtGui.QMenu("Maya", self)
        self.menuMaya.addAction(self.actConnectToMaya)
        self.menuMaya.addAction(self.actConnectToRemoteMaya)
        self.menuMaya.addAction(self.actDisConnectToMaya)
        self.menuMaya.addSeparator()
        self.menuMaya.addAction(self.actSendSelToMaya)
        self.menuMaya.addSeparator()
        self.menuMaya.addAction(self.actInstallMayaPlugin)

        self.menubar.addMenu(self.menuMaya)

    def createHoudiniCmds(self):
        # houdini
        self.actConnectToHoudini = QtGui.QAction(u"连接到Houdini", self)
        self.actConnectToRemoteHoudini = QtGui.QAction(u"连接到远程Houdini", self)
        self.actDisConnectToHoudini = QtGui.QAction(u"断开连接", self)
        self.actSendSelToHoudini = QtGui.QAction(u"发送到 Houdini", self)
        self.actSendSelToHoudini.setShortcut(QtGui.QKeySequence("h"))
        self.actInstallHoudiniPlugin = QtGui.QAction(u"安装houdini插件", self)
        ## Menu Houdini
        self.menuHoudini = QtGui.QMenu("Houdini", self)
        self.menuHoudini.addAction(self.actConnectToHoudini)
        self.menuHoudini.addAction(self.actConnectToRemoteHoudini)
        self.menuHoudini.addAction(self.actDisConnectToHoudini)
        self.menuHoudini.addSeparator()
        self.menuHoudini.addAction(self.actSendSelToHoudini)
        self.menuHoudini.addSeparator()
        self.menuHoudini.addAction(self.actInstallHoudiniPlugin)

        self.menubar.addMenu(self.menuHoudini)

    def createToolsCmds(self):
        # actions of tools
        self.actPubDaily = QtGui.QAction(u"发布 Daily", self)
        self.actConvertToRat = QtGui.QAction(u"批量转换成.rat", self)
        self.actConvertToBgeo = QtGui.QAction(u"批量转换成.bgeo", self)
        ## Menu Tools
        self.menuTools = QtGui.QMenu(u"工具", self)
        self.menuTools.addAction(self.actPubDaily)
        self.menuTools.addAction(self.actConvertToRat)
        self.menuTools.addAction(self.actConvertToBgeo)

        self.menubar.addMenu(self.menuTools)

    def createHelpCmds(self):
        # actions of help
        self.actDocumentation = QtGui.QAction(u"文档", self)
        self.actAbout = QtGui.QAction(u"关于AssetMG", self)
        ## Menu Help:
        self.menuHelp = QtGui.QMenu(u"帮助", self)
        self.menuHelp.addAction(self.actDocumentation)
        self.menuHelp.addAction(self.actAbout)
        ## Menu Help:
        self.connect(self.actDocumentation, QtCore.SIGNAL('triggered()'), self.doDocumentation)
        self.connect(self.actAbout, QtCore.SIGNAL('triggered()'), self.doAbout)

        self.menubar.addMenu(self.menuHelp)

    def showMSG(self, msg):
        self.statusbar.showMessage(msg)

    def createToolBar(self):
        self.mainToolbar = QtGui.QToolBar()
        self.mainToolbar.setAllowedAreas(QtCore.Qt.AllToolBarAreas)
        self.mainToolbar.setOrientation(QtCore.Qt.Horizontal)
        self.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolbar)
    
    def initCentralWidget(self):
        self.main_pane = Pane()
        self.setCentralWidget(self.main_pane)
    
    def createEditors(self):
        self.network_editor = NetworkEditor()
        self.connect(self.network_editor, QtCore.SIGNAL('goin'), self.goin)
        self.connect(self.network_editor, QtCore.SIGNAL('gout'), self.gout)
        self.main_pane.addTab(self.network_editor, self.network_editor.name)

    def initDockWidget(self):
        self.date_viewer = DailyEditor()
        self.date_viewer_dock = QtGui.QDockWidget(u"Daily", self)
        self.date_viewer_dock.setMinimumWidth(150)
        self.date_viewer_dock.setAllowedAreas(QtCore.Qt.RightDockWidgetArea)
        self.date_viewer_dock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
        self.date_viewer_dock.setFloating(False)
        self.date_viewer_dock.setWidget(self.date_viewer)
        self.date_viewer_dock.setVisible(True)
        
        self.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.date_viewer_dock)

    # ------------------------------------------------------------------------------------------
    #
    # ------------------------------------------------------------------------------------------
    # asset functions
    def getGoPath(self):
        return string.join(self.go_path, '/')

    def goo(self, a_id):
        self.network_editor.clearAll()
        if a_id == '/':
            assets_list = self.webbridge.getProjects()
            if not assets_list:
                return False
            for a in assets_list:
                if a.has_key('name'):
                    asset = AssetItem(a['name'])
                    asset.parent_id = '/'
                    asset.type = 'Project'
                    asset.asset_id = a['id']
                    asset.setPath(self.setting.getProjectPubPath())
                    self.network_editor.addAsset(asset)
            return True
        else:
            assets_list = self.webbridge.getAnything(a_id)
            if not assets_list:
                return False
            for a in assets_list:
                if a.has_key('name'):
                    asset = AssetItem(a['name'])
                    asset.parent_id = a_id
                    asset.asset_id = a['id']
                    if 'g' in asset.asset_id:
                        asset.type = 'Group'
                    elif 'a' in asset.asset_id:
                        asset.type = 'Asset'
                    elif 't' in asset.asset_id:
                        asset.type = "Task"
                        asset.version = a['version']
                    asset.setPath(self.getGoPath())
                    self.network_editor.addAsset(asset)
            return True

    def goin(self, a_id, name):
        self.go.append(a_id)
        if not name == '/':
            self.go_path.append(name)
        self.goo(a_id)
        self.network_editor.showPath(self.getGoPath())
        return True

    def gout(self):
        del self.go[-1]
        if not len(self.go_path) == 1:
            del self.go_path[-1]
        if len(self.go):
            self.goo(self.go[-1])
        else:
            self.goin('/', '/')
        self.network_editor.showPath(self.getGoPath())
        return True

    def doConnectToServer(self):
        login_dialog = LoginDialog()
        login_dialog.setInfo(self.webbridge.toDict())
        if login_dialog.exec_() == QtGui.QDialog.Accepted:
            info = login_dialog.getInfo()
            self.webbridge.setServer(info['server'], info['port'])
            if self.webbridge.login(info['user'], info['password']):
                self.goin('/', '/')
                self.showMSG(u"登陆成功,欢迎 %s" % info['user'])

            return True
        else:
            return False

    def doSetting(self):
        set_dialog = SettingDialog()
        set_dialog.setInfo(self.setting.toDict())
        if set_dialog.exec_() == QtGui.QDialog.Accepted:
            info = set_dialog.getInfo()
            self.setting.fromDict(info)
            self.setting.write()
            self.showMSG(u"设置成功")
            return True
        else:
            return False

    def doAddThumbToSelAsset(self):
        asset = self.network_editor.getAsset()
        thumb = asset.thumbFile()

        desktop = QtGui.QApplication.desktop()
        deskrect = desktop.screenGeometry()
        self.showMinimized()
        time.sleep(1)
        pic = QtGui.QPixmap.grabWindow(desktop.winId(), 0, 0, deskrect.width(), deskrect.height())
        
        self.showNormal()
        self.snap_dialog = PPSnap(pic, self)
        self.snap_dialog.showFullScreen()

        if self.snap_dialog.exec_() == QtGui.QDialog.Accepted:
            if self.snap_dialog.out_image:
                self.snap_dialog.out_image.save(thumb)
                asset.setThumb()
                return True
    
    def doShowAssetInExplorer(self):
        asset = self.network_editor.getAsset()
        asset_location = asset.path
        if os.path.isdir(asset_location):
            os.system("start explorer /root,%s" % string.replace(asset_location, "/", "\\"))
            return True
        else:
            self.showMSG(u"资产还没有发布")
            return False
        
    def doGoto(self):
        asset = self.network_editor.getAsset()
        workspace = asset.path
        if os.name == "nt":
            if not os.path.isdir(workspace):
                os.makedirs(workspace)
            os.chdir(workspace)
            os.system('start cmd')
        elif os.name == "posix":
            pass

    def doPublish(self):
        asset = self.network_editor.getAsset()
        goal_dir = asset.path
        
        publish_dialog = PublishDialog()
        info = {}
        info['asset'] = asset.name
        info['version'] = asset.version
        info['author'] = self.webbridge.user
        info['pub_to'] = goal_dir
        publish_dialog.setInfo(info)
        publish_dialog.start_dir = self.setting.job

        if publish_dialog.exec_() == QtGui.QDialog.Accepted:
            pub_files = publish_dialog.getFiles(self.setting.job)
            
            QtGui.QMessageBox.about(self, u"完成", u"发布成功")
            return True

    # maya functions
    def doConnectToMaya(self):
        pass

    def doConnectToRemoteMaya(self):
        pass

    def doDisConnectToMaya(self):
        pass

    def doSendSelToMaya(self):
        pass

    def doInstallMayaPlugin(self):
        pass

    # houdini functions
    def doConnectToHoudini(self):
        pass

    def doConnectToRemoteHoudini(self):
        pass

    def doDisConnectToHoudini(self):
        pass

    def doSendSelToHoudini(self):
        pass

    def doInstallHoudiniPlugin(self):
        pass

    # tool functions
    def doPubDaily(self):
        pass

    def doConvertToRat(self):
        pass

    def doConvertToBgeo(self):
        pass

    # help functions
    def doDocumentation(self):
        if not self.doc_dialog:
            self.doc_dialog = DocDialog(self)
            doc_file = os.path.join(RUNTIMEDIR, "doc")
            doc_file = os.path.join(doc_file, 'doc.txt')
            f = open(doc_file, 'r')
            docu = f.read()
            f.close()
            self.doc_dialog.showDoc(docu.decode('utf-8'))

        self.doc_dialog.show()

    def doAbout(self):
        QtGui.QMessageBox.about(self, "About", "Develop by Kun.Wang\nCopyright Pillars CG Technology.\n2013.01.01")