Exemple #1
0
    def build_popup(self, parent, *a):
        cmd.setParent(parent, m=True)
        cmd.menu(parent, e=True, dai=True)

        thisFile = Path(cmd.file(q=True, sn=True))

        #if the file doesn't exist, then use teh cwd
        if not thisFile.exists():
            thisFile = thisFile.getcwd() / "tmp.ma"

        dir = thisFile.up()
        curFile = Path(cmd.textField(self.UI_file, q=True, tx=True))

        for f in dir.files():
            if f.hasExtension(skinWeights.EXTENSION):
                cmd.menuItem(l=f.name(),
                             cb=f == curFile,
                             c=api.Callback(cmd.textField,
                                            self.UI_file,
                                            e=True,
                                            tx=f))

        cmd.menuItem(d=True)
        cmd.menuItem(l="browse", c=self.on_browseWeightFile)
        cmd.menuItem(d=True)
        cmd.menuItem(l="clear",
                     c=lambda *a: cmd.textField(self.UI_file, e=True, tx=''))
        if curFile.exists():
            cmd.menuItem(d=True)
            api.addExploreToMenuItems(curFile)
Exemple #2
0
    def popup_filemenu(self, parent, *args):
        cmd.menu(parent, e=True, dai=True)
        cmd.setParent(parent, m=True)

        other = self.other()
        items = self.selected()
        numItems = len(items)
        if numItems:
            cmd.menuItem(l='copy to %s' % other, c=self.copy)
            cmd.menuItem(l='move to %s' % other, c=self.move)

            if len(items) == 1:
                filepath = items[0].resolve()
                cmd.menuItem(d=True)
                cmd.menuItem(l='open in notepad',
                             c=lambda *x: self.on_notepad(filepath))

                #if the files are global files, display the perforce menu
                if self.locale == GLOBAL:
                    cmd.menuItem(d=True)
                    api.addPerforceMenuItems(filepath)
                cmd.menuItem(d=True)
                api.addExploreToMenuItems(filepath)

            cmd.menuItem(d=True)
            cmd.menuItem(l='delete', c=self.delete)

        #if the file is a global file, display an option to sync to presets
        if self.locale == GLOBAL:
            if numItems: cmd.menuItem(d=True)
            cmd.menuItem(l='sync to presets', c=self.syncall)

        #if no files are selected, prompt the user to select files
        if numItems == 0: cmd.menuItem(en=False, l='select a preset file')
	def popup_filemenu( self, parent, *args ):
		cmd.menu(parent, e=True, dai=True)
		cmd.setParent(parent, m=True)

		other = self.other()
		items = self.selected()
		numItems = len(items)
		if numItems:
			cmd.menuItem(l='copy to %s' % other, c=self.copy)
			cmd.menuItem(l='move to %s' % other, c=self.move)

			if len(items) == 1:
				filepath = items[0].resolve()
				cmd.menuItem(d=True)
				cmd.menuItem(l='open in notepad', c=lambda *x: self.on_notepad( filepath ))

				#if the files are global files, display the perforce menu
				if self.locale == GLOBAL:
					cmd.menuItem(d=True)
					api.addPerforceMenuItems(filepath)
				cmd.menuItem(d=True)
				api.addExploreToMenuItems(filepath)

			cmd.menuItem(d=True)
			cmd.menuItem(l='delete', c=self.delete)

		#if the file is a global file, display an option to sync to presets
		if self.locale == GLOBAL:
			if numItems: cmd.menuItem(d=True)
			cmd.menuItem(l='sync to presets', c=self.syncall)

		#if no files are selected, prompt the user to select files
		if numItems == 0: cmd.menuItem(en=False, l='select a preset file')
	def popup_files( self, parent, *args ):
		cmd.setParent( parent, m=True )
		cmd.menu( parent, e=True, dai=True )

		files = self.getSelectedFiles()
		if len( files ) == 1:
			if self._enableOpen:
				cmd.menuItem( l='open file', c=lambda *x: self.on_open( files[ 0 ] ) )

			if self._enableImport:
				cmd.menuItem( l='import file', c=lambda *x: self.on_import( files[ 0 ] ) )

			if self._enableReference:
				cmd.menuItem( l='reference file', c=lambda *x: self.on_reference( files[ 0 ] ) )

			cmd.menuItem( d=True )
			api.addPerforceMenuItems( files[ 0 ] )
			cmd.menuItem( d=True )
			api.addExploreToMenuItems( files[ 0 ] )
		else:
			cmd.menuItem( l="please select a single file" )

		cmd.menuItem( d=True )
		cmd.menuItem( cb=self.getDisplayRelative(), l="Display Relative Paths", c=lambda *x: self.setDisplayRelative( not self.getDisplayRelative() ) )
		cmd.menuItem( cb=self.getRecursive(), l="Recursive Directory Listing", c=lambda *x: self.setRecursive( not self.getRecursive() ) )
	def build_popup( self, parent, *a ):
		cmd.setParent( parent, m=True )
		cmd.menu( parent, e=True, dai=True )

		thisFile = Path( cmd.file( q=True, sn=True ) )

		#if the file doesn't exist, then use teh cwd
		if not thisFile.exists:
			thisFile = thisFile.getcwd() / "tmp.ma"

		dir = thisFile.up()
		curFile = Path( cmd.textField( self.UI_file, q=True, tx=True ) )

		for f in dir.files():
			if f.hasExtension( skinWeights.EXTENSION ):
				cmd.menuItem( l=f.name(), cb=f==curFile, c=api.Callback( cmd.textField, self.UI_file, e=True, tx=f ) )

		cmd.menuItem( d=True )
		cmd.menuItem( l="browse", c=self.on_browseWeightFile )
		cmd.menuItem( d=True )
		cmd.menuItem( l="clear", c=lambda *a: cmd.textField( self.UI_file, e=True, tx='' ) )
		if curFile.exists:
			cmd.menuItem( d=True )
			api.addExploreToMenuItems( curFile )