Beispiel #1
0
    def doUI(self, parent):

        self.scrFrame = Pmw.ScrolledFrame(self,
                                          frame_relief='sunken',
                                          horizflex='expand')
        self.scrFrame.grid(row=0,
                           column=0,
                           padx=5,
                           columnspan=2,
                           sticky='nsew')
        self.rowFrame = self.scrFrame.component('frame')

        self.addB = Tkinter.Button(self, command=self._addCB)
        plus_image = chimage.get("plus.gif", self.addB)
        self.addB.configure(image=plus_image)
        self.addB._image = plus_image
        help.register(self.addB,
                      balloon="Add a row below currently selected row")
        self.addB.grid(row=1, column=0, pady=5, padx=0, sticky='n')

        self.delB = Tkinter.Button(self, command=self._delCB)
        minus_image = chimage.get("minus.gif", self.delB)
        self.delB.configure(image=minus_image)
        self.delB._image = minus_image
        help.register(self.delB, balloon="Delete the currently selected row")
        self.delB.grid(row=1, column=1, pady=5, padx=0, sticky='nw')
        self.delB.configure(state="disabled")

        self.rowconfigure(0, weight=10)
        self.rowconfigure(1, weight=0)

        self.columnconfigure(1, weight=10)
    def doUI(self, parent):
        
        self.scrFrame = Pmw.ScrolledFrame(self, frame_relief='sunken',
                                          horizflex='expand')
	self.scrFrame.grid(row=0, column=0,padx=5, columnspan=2, sticky='nsew')
        self.rowFrame = self.scrFrame.component('frame')
        	
	self.addB = Tkinter.Button(self, command=self._addCB)
        plus_image = chimage.get("plus.gif",self.addB)
        self.addB.configure(image=plus_image)
        self.addB._image = plus_image
        help.register(self.addB, balloon="Add a row below currently selected row")
	self.addB.grid(row=1,column=0,pady=5,padx=0,sticky='n')

        
	self.delB = Tkinter.Button(self, command=self._delCB)
        minus_image = chimage.get("minus.gif",self.delB)
        self.delB.configure(image=minus_image)
        self.delB._image = minus_image
        help.register(self.delB, balloon="Delete the currently selected row")
	self.delB.grid(row=1,column=1,pady=5,padx=0,sticky='nw')
        self.delB.configure(state="disabled")
        
        self.rowconfigure(0, weight=10)
        self.rowconfigure(1, weight=0)

        self.columnconfigure(1, weight=10)
Beispiel #3
0
	def _makeActionGroup(self, parent):
		from prefs import prefs
		from chimera import chimage
		import Tkinter, Pmw

		d = prefs.get("treatment", {})
		self.treatmentShow = d.get("show", 0)
		selAtoms = d.get("selectAtoms", 0)
		selModels = d.get("selectModels", 0)
		hideOthers = d.get("hideOthers", 1)

		self.rightArrow = chimage.get("rightarrow.png", parent)
		self.downArrow = chimage.get("downarrow.png", parent)

		if self.treatmentShow:
			relief = "groove"
			image = self.downArrow
		else:
			relief = "flat"
			image = self.rightArrow
		self.treatmentGroup = Pmw.Group(parent,
				collapsedsize=0,
				tagindent=0,
				ring_relief=relief,
				tag_pyclass=Tkinter.Button,
				tag_text=" Treatment of Chosen Models",
				tag_relief="flat",
				tag_compound="left",
				tag_image=image,
				tag_command=self._treatmentCB)
		if not self.treatmentShow:
			self.treatmentGroup.collapse()
		self.treatmentGroup.pack(side="top", fill="x", padx=3)
		interior = self.treatmentGroup.interior()
		self.treatmentSelAtom = Tkinter.IntVar(parent)
		self.treatmentSelAtom.set(selAtoms)
		b = Tkinter.Checkbutton(interior,
					text="Select atoms",
					onvalue=1, offvalue=0,
					variable=self.treatmentSelAtom,
					command=self._treatmentChangedCB)
		b.pack(side="left")
		self.treatmentSelModel = Tkinter.IntVar(parent)
		self.treatmentSelModel.set(selModels)
		b = Tkinter.Checkbutton(interior,
					text="Choose in Model Panel",
					onvalue=1, offvalue=0,
					variable=self.treatmentSelModel,
					command=self._treatmentChangedCB)
		b.pack(side="left")
		self.treatmentHideOthers = Tkinter.IntVar(parent)
		self.treatmentHideOthers.set(hideOthers)
		b = Tkinter.Checkbutton(interior,
					text="Hide others",
					onvalue=1, offvalue=0,
					variable=self.treatmentHideOthers,
					command=self._treatmentChangedCB)
		b.pack(side="left")
Beispiel #4
0
	def fillInUI(self, parent):
		#
		# Construct user interface
		#
		self.modelVars = {}

		# Find images
		top = parent.winfo_toplevel()
		dir = os.path.dirname(__file__)
		icon = os.path.join(dir, 'move.tiff')
		self.moveIcon = chimage.get(icon, top)
		icon = os.path.join(dir, 'zoom.tiff')
		self.zoomIcon = chimage.get(icon, top)
		icon = os.path.join(dir, 'reset.tiff')
		self.resetIcon = chimage.get(icon, top)

		# Label rows
		for n in range(len(self.refModels)):
			parent.rowconfigure(n + 1, weight=1)
			m = self.refModels[n]
			lf = Tkinter.Frame(parent, relief=Tkinter.GROOVE, bd=2)
			lf.grid(row=n + 1, column=0, sticky='nsew')
			self._addRefConformer(lf, m)

		# Label columns
		for n in range(len(self.altModels)):
			parent.columnconfigure(n + 1, weight=1)
			m = self.altModels[n]
			lf = Tkinter.Frame(parent, relief=Tkinter.GROOVE, bd=2)
			lf.grid(row=0, column=n + 1, sticky='nsew')
			self._addAltConformer(lf, m)

		# Add table entries
		# Each column comprises a set of radio buttons.
		# This design is selected because each conformer
		# in the alternative ensemble can only be matched
		# to a single conformer in the reference ensemble.
		self.matchVars = {}
		for a in range(len(self.altModels)):
			alt = self.altModels[a]
			var = Tkinter.IntVar(parent)
			var.set(-1)
			self.matchVars[alt] = var
			for r in range(len(self.refModels)):
				ref = self.refModels[r]
				m = chimera.match.Match(self.atomDict[ref],
							self.atomDict[alt])
				b = Tkinter.Radiobutton(parent,
						relief=Tkinter.SUNKEN,
						text='%.3f' % m.rms,
						value=r,
						variable=var,
						command=lambda s=self, m=alt:
							s.matchModel(m))
				b.grid(column=a + 1, row=r + 1, sticky='nsew')
Beispiel #5
0
    def fillInUI(self, parent):
        #
        # Construct user interface
        #
        self.modelVars = {}

        # Find images
        top = parent.winfo_toplevel()
        dir = os.path.dirname(__file__)
        icon = os.path.join(dir, 'move.tiff')
        self.moveIcon = chimage.get(icon, top)
        icon = os.path.join(dir, 'zoom.tiff')
        self.zoomIcon = chimage.get(icon, top)
        icon = os.path.join(dir, 'reset.tiff')
        self.resetIcon = chimage.get(icon, top)

        # Label rows
        for n in range(len(self.refModels)):
            parent.rowconfigure(n + 1, weight=1)
            m = self.refModels[n]
            lf = Tkinter.Frame(parent, relief=Tkinter.GROOVE, bd=2)
            lf.grid(row=n + 1, column=0, sticky='nsew')
            self._addRefConformer(lf, m)

        # Label columns
        for n in range(len(self.altModels)):
            parent.columnconfigure(n + 1, weight=1)
            m = self.altModels[n]
            lf = Tkinter.Frame(parent, relief=Tkinter.GROOVE, bd=2)
            lf.grid(row=0, column=n + 1, sticky='nsew')
            self._addAltConformer(lf, m)

        # Add table entries
        # Each column comprises a set of radio buttons.
        # This design is selected because each conformer
        # in the alternative ensemble can only be matched
        # to a single conformer in the reference ensemble.
        self.matchVars = {}
        for a in range(len(self.altModels)):
            alt = self.altModels[a]
            var = Tkinter.IntVar(parent)
            var.set(-1)
            self.matchVars[alt] = var
            for r in range(len(self.refModels)):
                ref = self.refModels[r]
                m = chimera.match.Match(self.atomDict[ref], self.atomDict[alt])
                b = Tkinter.Radiobutton(
                    parent,
                    relief=Tkinter.SUNKEN,
                    text='%.3f' % m.rms,
                    value=r,
                    variable=var,
                    command=lambda s=self, m=alt: s.matchModel(m))
                b.grid(column=a + 1, row=r + 1, sticky='nsew')
    def populateListFrame(self):
        
        self.panelsLabel = Tkinter.Label(self.pListFrame, text="Panels", font="helvetica -14 bold")
        self.panelsLabel.grid(row=0, column=0, columnspan=4, sticky='w')
        
        self.panelList = Pmw.ScrolledListBox(self.pListFrame,
                                             labelmargin=10,
                                             listbox_height=5, listbox_width=20,
					     listbox_selectmode=Tkinter.SINGLE,
					     selectioncommand=self.refreshPanelCB,
                                             listbox_exportselection=False)
                                             #dblclickcommand=self.showPanelEntry)
        self.panelList.grid(row=1, column=0, padx=10, columnspan=4, sticky='nsew')

        
        this_dir = os.path.split(Demo.__file__)[0]
	self.upButton = Tkinter.Button(self.pListFrame, command=self.panelUp)
        up_image=chimage.get("arrow_up.gif", self.upButton)#text="/\\")
        self.upButton.configure(image=up_image, state="disabled")
        self.upButton._image = up_image
        help.register(self.upButton, balloon="Move currently selected panel up")
	self.upButton.grid(row=2,column=0,sticky='s')

	self.downButton=Tkinter.Button(self.pListFrame, command=self.panelDown)
        down_image=chimage.get("arrow_down.gif", self.downButton)#text="/\\")
        self.downButton.configure(image=down_image, state="disabled")
        self.downButton._image = down_image
        help.register(self.downButton, balloon="Move currently selected panel down")
	self.downButton.grid(row=3,column=0,sticky='n')

	self.deleteButton = Tkinter.Button(self.pListFrame, text="Delete", command=self.deletePanel, state="disabled")
        help.register(self.deleteButton, balloon="Delete currently selected panel")
        self.deleteButton.grid(row=2,column=1,rowspan=2)

        self.newButton = Tkinter.Button(self.pListFrame, text="New", command=self.newPanelCB)
        help.register(self.newButton, balloon="Add a new panel")
        self.newButton.grid(row=2, column=2,rowspan=2)

        #self.editGlobalB = Tkinter.Button(self.pListFrame, text="Edit Demo Options",
        #                                  command=self.editGlobalCB)
        #help.register(self.editGlobalB, balloon="Edit global options for Demo")
        #self.editGlobalB.grid(row=4,column=0,columnspan=4, sticky='w')
	
        self.pListFrame.rowconfigure(0, weight=1)
        self.pListFrame.rowconfigure(1, weight=20)
        self.pListFrame.rowconfigure(2, weight=1)
	self.pListFrame.rowconfigure(3, weight=1)
        self.pListFrame.rowconfigure(4, weight=1)
    def fillInUI(self, master):
        from chimera import chimage
        import Tkinter

        import os.path
        thisfile = os.path.abspath(__file__)
        thisdir = os.path.split(thisfile)[0]

        icon = chimage.get(os.path.join(thisdir, 'chimera_icon_small.png'),
                           master)
        l = Tkinter.Label(master, image=icon, borderwidth=10)
        l.__image = icon
        l.pack(side='left')
        lab = Tkinter.Label(
            master,
            borderwidth=10,
            justify='left',
            text="Demos listed in the Tools menu were made using\n"
            "Chimera's Demo feature, which enables the easy\n"
            "creation and replay of custom multistep demos.\n"
            "Each step is comprised of a set of operations performed\n"
            "in Chimera, and an accompanying block of explanatory text.\n"
            "\n"
            "For more information on how to create demos, click the Help button.\n"
        )
        lab.pack(side='right')
    def __init__(self, box_changed_cb):

        self.box_model = Box_Model()
        self.box_changed_cb = box_changed_cb
        self.ijk_in = None  # Box coordinates
        self.ijk_out = None
        self.mode_name = 'volume subregion'  # For mouse modes panel
        self.bound_button = None
        self.drag_mode = None
        self.rotation_handler = None

        callbacks = (self.mouse_down_cb, self.mouse_drag_cb, self.mouse_up_cb)

        icon_file = 'selectregion.gif'
        if icon_file:
            import os.path
            icon_path = os.path.join(os.path.dirname(__file__), icon_file)
            from PIL import Image
            image = Image.open(icon_path)
            from chimera import chimage
            from chimera import tkgui
            icon = chimage.get(image, tkgui.app)
        else:
            icon = None

        from chimera import mousemodes
        mousemodes.addFunction(self.mode_name, callbacks, icon)
Beispiel #9
0
    def mouse_mode_icon(self, filename):

        import os.path
        icon_path = os.path.join(os.path.dirname(__file__), filename)
        from PIL import Image
        image = Image.open(icon_path)
        from chimera import chimage, tkgui
        icon = chimage.get(image, tkgui.app)
        return icon
Beispiel #10
0
	def __init__(self):
		import os.path
		myDir, junk = os.path.split(__file__)
		addFunction('place text', (self._pickLabel, self._moveLabel,
			None), icon=chimage.get(Image.open(os.path.join(myDir,
						'ilabel.png')), tkgui.app))
		addFunction('place key', (self._startOrGrabKey,
			self._sizeOrMoveKey, None), icon=chimage.get(
			Image.open(os.path.join(myDir, 'key.png')), tkgui.app))

		import Ilabel
		if not Ilabel._ilabelModel:
			Ilabel.IlabelModel()
		self.model = Ilabel._ilabelModel
		ModelessDialog.__init__(self)
		self._sessionHandlerID = chimera.triggers.addHandler(
					SAVE_SESSION, self._saveSession, None)
		self._closeHandlerID = chimera.triggers.addHandler(
					CLOSE_SESSION, self.destroy, None)
		self._beginRestoreHandlerID = chimera.triggers.addHandler(
				BEGIN_RESTORE_SESSION, self.destroy, None)
Beispiel #11
0
	def __init__(self, master, automultilineHeaders=True, menuInfo=None,
						allowUserSorting=True):
		self.tixTable = None
		self.data = None
		self.columns = []
		self.sorting = None
		self.allowUserSorting = allowUserSorting
		self.automultilineHeaders = automultilineHeaders
		self.menuInfo = menuInfo
		Tkinter.Frame.__init__(self, master)
		try:
			from chimera import chimage
			self.upArrow = chimage.get("uparrow.png", self)
			self.downArrow = chimage.get("downarrow.png", self)
		except ImportError:
			self.upArrow = "^"
			self.downArrow = "v"
		self._sortCache = None
		self._lastBrowseSel = None
		self._highlighted = []
		self._widgetData = {}
Beispiel #12
0
    def __init__(self):
        import os.path
        myDir, junk = os.path.split(__file__)
        addFunction('place text', (self._pickLabel, self._moveLabel, None),
                    icon=chimage.get(
                        Image.open(os.path.join(myDir, 'ilabel.png')),
                        tkgui.app))
        addFunction('place key',
                    (self._startOrGrabKey, self._sizeOrMoveKey, None),
                    icon=chimage.get(
                        Image.open(os.path.join(myDir, 'key.png')), tkgui.app))

        import Ilabel
        if not Ilabel._ilabelModel:
            Ilabel.IlabelModel()
        self.model = Ilabel._ilabelModel
        ModelessDialog.__init__(self)
        self._sessionHandlerID = chimera.triggers.addHandler(
            SAVE_SESSION, self._saveSession, None)
        self._closeHandlerID = chimera.triggers.addHandler(
            CLOSE_SESSION, self.destroy, None)
        self._beginRestoreHandlerID = chimera.triggers.addHandler(
            BEGIN_RESTORE_SESSION, self.destroy, None)
 def __init__(self,
              master,
              automultilineHeaders=True,
              menuInfo=None,
              allowUserSorting=True):
     self.tixTable = None
     self.data = None
     self.columns = []
     self.sorting = None
     self.allowUserSorting = allowUserSorting
     self.automultilineHeaders = automultilineHeaders
     self.menuInfo = menuInfo
     Tkinter.Frame.__init__(self, master)
     try:
         from chimera import chimage
         self.upArrow = chimage.get("uparrow.png", self)
         self.downArrow = chimage.get("downarrow.png", self)
     except ImportError:
         self.upArrow = "^"
         self.downArrow = "v"
     self._sortCache = None
     self._lastBrowseSel = None
     self._highlighted = []
     self._widgetData = {}
Beispiel #14
0
    def addImg(self):

        if self.img_bg_color:
            try:
                self.imgFrame.configure(background=self.img_bg_color)
            except Tkinter.TclError:
                pass
        
        from chimera import chimage
        self._wizImage = chimage.get(self.img_src, self.imgFrame)

        self._wizLabel = Tkinter.Label(self.imgFrame, image=self._wizImage, borderwidth=0)
        self._wizLabel.__image = self._wizImage
        
        self._wizLabel.pack(side='left', anchor='n')
Beispiel #15
0
    def addImg(self):

        if self.img_bg_color:
            try:
                self.imgFrame.configure(background=self.img_bg_color)
            except Tkinter.TclError:
                pass

        from chimera import chimage
        self._wizImage = chimage.get(self.img_src, self.imgFrame)

        self._wizLabel = Tkinter.Label(self.imgFrame,
                                       image=self._wizImage,
                                       borderwidth=0)
        self._wizLabel.__image = self._wizImage

        self._wizLabel.pack(side='left', anchor='n')
Beispiel #16
0
	def fillInUI(self, master):
		from chimera import chimage
                import Tkinter

                import os.path
                thisfile = os.path.abspath(__file__)
                thisdir  = os.path.split(thisfile)[0]
                
		icon = chimage.get( os.path.join(thisdir, 'chimera_icon_small.png'), master)
		l = Tkinter.Label(master, image=icon, borderwidth=10)
		l.__image = icon
		l.pack(side='left')
		lab = Tkinter.Label(master, borderwidth=10, justify='left',
                                    text=
                                    "Demos listed in the Tools menu were made using\n"
                                    "Chimera's Demo feature, which enables the easy\n"
                                    "creation and replay of custom multistep demos.\n"
                                    "Each step is comprised of a set of operations performed\n" 
                                    "in Chimera, and an accompanying block of explanatory text.\n"
                                    "\n"
                                    "For more information on how to create demos, click the Help button.\n"
                                    )
		lab.pack(side='right')
    def fillInUI(self, parent):
        #recCtrlFrame = Tkinter.Frame(parent)
        #recCtrlFrame.grid(row=0,column=0,columnspan=2, sticky='w', pady=10, padx=10)


        ##--------Record button-----------##
        self.recButton = Tkinter.Button(parent, text="Record", command=self.startRecording)
        #self.rec_img   = chimage.get(os.path.join(self.this_dir, "record.png"), self.recButton)
        #self.pause_img = chimage.get(os.path.join(self.this_dir, "pause.png"),  self.recButton)
        #self.recButton.configure(image=self.rec_img, relief='flat')
        #self.recButton._rec_image   = self.rec_img
        #self.recButton._pause_image = self.pause_img
        help.register(self.recButton,   balloon="Start capturing frames from the graphics window")
        self.recButton.grid(row=0,column=0, sticky='w', pady=5, padx=10)
        ## ---------------------------------

            

        ##--------Encode button-----------##
        self.encButton = Tkinter.Button(parent, text="Make movie", command = self.startEncoding)
        #self.movie_img = chimage.get(os.path.join(self.this_dir, "movie.png"),        self.encButton)
        #self.abort_img = chimage.get(os.path.join(self.this_dir, "abort_movie.png"),  self.encButton)

        #self.encButton.configure(image=self.movie_img, relief='flat')
        #self.encButton._movie_img  = self.movie_img
        #self.encButton._abort_img  = self.abort_img
        help.register(self.encButton,   balloon="Make a movie from currently captured frames")
        
        self.encButton.grid(row=0,column=1, sticky='w')

        ## can't encode yet - don't have any frames cached !
        self.encButton.configure(state='disabled')
        ## ------------------------------------



        ##--------Reset button-----------##
        self.clearButton = Tkinter.Button(parent,
                                          text="Reset",
                                          command=self.resetRecording)
        help.register(self.clearButton, balloon="Clear all saved frames")
        self.clearButton.configure(state='disabled')
        self.clearButton.grid(row=1, column=0, sticky='w', pady=5, padx=10)
        ## ---------------------------------



        ## ------Reset after encode-------------
        self.autoResetVar = Tkinter.IntVar(parent)
        self.autoResetVar.set(1)

        autoResetChB = Tkinter.Checkbutton(parent,
                                           text="Reset after encode",
                                           variable = self.autoResetVar,
                                           command  = self.resetModeCB
                                           )
        autoResetChB.grid(row=1,column=1, sticky='w')
        ## -------------------------------------



        
        #-------Movie format---------------------------
        self.movieFmtOption = MovieFmtTkOption(parent,
                                               2, 'Output format',
                                               default_format,
                                               self.chooseFmtCB)
        ## ------------------------------------------------


        
        ## -------------Output path ------------------
        outputFrame = Tkinter.Frame(parent)
        from OpenSave import tildeExpand
        initialfile = os.path.join(tildeExpand("~"), DEFAULT_OUTFILE)

        from OpenSave import SaveModeless
        class OutputPathDialog(SaveModeless):
            default = 'Set Movie Path'
            title = 'Select movie output file'
            def SetMoviePath(self):
                self.Save()
        setattr(OutputPathDialog, OutputPathDialog.default,
                OutputPathDialog.SetMoviePath) # Work around OpenSave bug
        ofo = tkoptions.OutputFileOption(outputFrame,
                                         0, 'Output file',
                                         initialfile,
                                         None,
                                         balloon = 'Output file save location '
                                         )
        ofo.dialogType = OutputPathDialog
        self.outFileOption = ofo
        outputFrame.grid(row=3, column=0, columnspan=3, sticky='ew', pady=10)
        outputFrame.columnconfigure(1, weight=1)
        ## -------------------------------------------
        

        

    
        statsGroup = Pmw.Group(parent, tag_text="Status")
        statsGroup.grid(row=0, column=2, rowspan=3, padx=20, sticky='nsew')
        #statsGroup.configure(hull_width=1000)
        
        self.frame_num_var = Tkinter.StringVar(parent)
        self.time_left_var = Tkinter.StringVar(parent)

        self.actionLabel    = Tkinter.Label(statsGroup.interior(), text="Stopped")
        numFramesLabel = Tkinter.Label(statsGroup.interior(),
                                       text = "# Frames:")#,

        frameResLabel = Tkinter.Label(statsGroup.interior(),
                                      text = "Resolution:")#,

        estLengthLabel = Tkinter.Label(statsGroup.interior(),
                                       text = "Est. Length:")#,

        #statsGroup.interior().rowconfigure(0,weight=1)
        statsGroup.interior().columnconfigure(2,weight=1)

        self.accum_frames_var = Tkinter.StringVar(parent)
        self.accum_frames_var.set('0')

        self.frame_res_var = Tkinter.StringVar(parent)
        self.frame_res_var.set('%dx%d' % chimera.viewer.windowSize)
        
        self.accum_secs_var   = Tkinter.StringVar(parent)
        self.accum_secs_var.set('0s.')

        
        numFramesVal = Tkinter.Label(statsGroup.interior(),
                                     textvariable = self.accum_frames_var)

        frameResVal = Tkinter.Label(statsGroup.interior(),
                                     textvariable = self.frame_res_var)
        
        estLengthVal = Tkinter.Label(statsGroup.interior(),
                                     textvariable = self.accum_secs_var)
        
        self.actionLabel.grid(row=0,column=0, columnspan=2, pady=2, sticky='w')
        numFramesLabel.grid(row=1,column=0, pady=2, sticky='w')
        frameResLabel.grid(row=2, column=0, pady=2, sticky='w')
        estLengthLabel.grid(row=3, column=0, pady=2, sticky='w')

        numFramesVal.grid(row=1, column=1, padx=5, sticky='w')
        frameResVal.grid(row=2, column=1, padx=5, sticky='w')
        estLengthVal.grid(row=3, column=1, padx=5, sticky='w')

        
        parent.columnconfigure(2, weight=1)
        parent.columnconfigure(3, weight=2)
        parent.rowconfigure(9, weight=1)

        dummyFrame = Tkinter.Frame(parent, relief='groove', borderwidth=1)
        Tkinter.Frame(dummyFrame).pack()
        dummyFrame.grid(row=4,column=0,columnspan=3, pady=10, sticky='ew')

        ## -------------- Frame options -----------------------
        frmOptChBFrame = Tkinter.Frame(parent, background="gray")
        frmOptChBFrame.grid(row=5, column=0,columnspan=3, pady=5, sticky='ew')
        frmOptChBFrame.columnconfigure(1, weight=1)

        self.frmOptionsVar = Tkinter.IntVar(frmOptChBFrame)
        frmOptionsChB = Tkinter.Checkbutton(frmOptChBFrame,
                                            indicatoron=False,
                                            selectcolor='',
                                            background="gray",
                                            offrelief='flat',
                                            overrelief='flat',
                                            text = "Options...",
                                            relief='flat',
                                            variable=self.frmOptionsVar,
                                            command = self.showFrmOptionsCB)

        r_arrow_img=chimage.get("rightarrow.png", frmOptionsChB)
        frmOptionsChB.configure(image=r_arrow_img)
        frmOptionsChB._image = r_arrow_img

        d_arrow_img=chimage.get("downarrow.png", frmOptionsChB)
        frmOptionsChB.configure(selectimage=d_arrow_img)
        frmOptionsChB._selectimage = d_arrow_img

        #frmOptionsChB.configure(relief='sunken')
        #print frmOptionsChB.configure().keys()
        frmOptionsChB.grid(row=0, column=0, sticky='w')

        frmOptionsLabel = Tkinter.Label(frmOptChBFrame, text="Frame Options", background="gray")
        frmOptionsLabel.grid(row=0,column=1, sticky='w', padx=5)

        self.frmOptionsFrame = Tkinter.Frame(parent)
        self.populateFrmOptionsFrame()
        ## ---------------------------------------------------
        
        
        ## --------------------- Movie options -----------------

        movOptChBFrame = Tkinter.Frame(parent, background="gray")
        movOptChBFrame.grid(row=7, column=0,columnspan=3, pady=5, sticky='ew')
        movOptChBFrame.columnconfigure(1, weight=1)

        self.movOptionsVar = Tkinter.IntVar(movOptChBFrame)
        movOptionsChB = Tkinter.Checkbutton(movOptChBFrame,
                                            indicatoron=False,
                                            selectcolor='',
                                            background="gray",
                                            offrelief='flat',
                                            overrelief='flat',
                                            text = "Options...",
                                            relief='flat',
                                            variable=self.movOptionsVar,
                                            command = self.showMovOptionsCB)

        movOptionsChB.configure(image=r_arrow_img)
        movOptionsChB._image = r_arrow_img

        movOptionsChB.configure(selectimage=d_arrow_img)
        movOptionsChB._selectimage = d_arrow_img

        movOptionsChB.grid(row=0, column=0, sticky='w', pady=0)

        movOptionsLabel = Tkinter.Label(movOptChBFrame, text="Movie Options", background="gray")
        movOptionsLabel.grid(row=0,column=1, sticky='w', padx=5)

        
        self.movOptionsFrame = Tkinter.Frame(parent)
        self.populateMovOptionsFrame()
        self.movOptionsFrame.columnconfigure(0, weight=1)
Beispiel #18
0
	def fillInUI(self, parent):
		import Pmw, Tkinter
		from chimera import chimage
		self.parent = parent

		d = prefs.get("treatment", {})
		self.treatmentShow = d.get("show", 0)
		self.treatmentSelAtom = d.get("selectAtoms", 0)
		self.treatmentSelAtomOf = d.get("selectAtomsOf", "all members")
		self.treatmentSelModel = d.get("selectModels", 1)
		self.treatmentSelModelOf = d.get("selectModelsOf", "all members")
		self.treatmentColorModel = d.get("colorModels", 1)
		self.treatmentColorModelOf = d.get("colorModelsOf", "all members")

		self.rightArrow = chimage.get("rightarrow.png", parent)
		self.downArrow = chimage.get("downarrow.png", parent)

		if self.treatmentShow:
			relief = "sunken"
			image = self.downArrow
		else:
			relief = "flat"
			image = self.rightArrow
		self.treatmentGroup = Pmw.Group(parent,
					collapsedsize=0,
					tagindent=0,
					ring_relief=relief,
					tag_pyclass=Tkinter.Button,
					tag_text=" Treatment of Chosen Clusters",
					tag_relief="flat",
					tag_compound="left",
					tag_image=image,
					tag_command=self._treatmentCB)
		if not self.treatmentShow:
			self.treatmentGroup.collapse()
		self.treatmentGroup.pack(side="top", fill="x", padx=3)

		self.treatmentSelAtomVar = Tkinter.IntVar(parent)
		if self.treatmentSelAtom:
			self.treatmentSelAtomVar.set(1)
		else:
			self.treatmentSelAtomVar.set(0)
		f = Tkinter.Frame(self.treatmentGroup.interior())
		f.pack(side="top", fill="x")
		self.treatmentSelAtomButton = Tkinter.Checkbutton(f,
					text=" Select atoms of",
					onvalue=1, offvalue=0,
					variable=self.treatmentSelAtomVar,
					command=self._treatmentSelAtomCB)
		self.treatmentSelAtomButton.pack(side="left")
		self.treatmentSelAtomMenu = Pmw.OptionMenu(f,
					items = ( "representatives",
							"all members" ),
					initialitem=self.treatmentSelAtomOf,
					menubutton_pady=0,
					command=self._treatmentSelAtomCB)
		self.treatmentSelAtomMenu.pack(side="left")

		self.treatmentColorModelVar = Tkinter.IntVar(parent)
		if self.treatmentColorModel:
			self.treatmentColorModelVar.set(1)
		else:
			self.treatmentColorModelVar.set(0)
		f = Tkinter.Frame(self.treatmentGroup.interior())
		f.pack(side="top", fill="x")
		self.treatmentColorModelButton = Tkinter.Checkbutton(f,
					text=" Color",
					onvalue=1, offvalue=0,
					variable=self.treatmentColorModelVar,
					command=self._treatmentColorModelCB)
		self.treatmentColorModelButton.pack(side="left")
		self.treatmentColorModelMenu = Pmw.OptionMenu(f,
					items = ( "representatives",
							"all members" ),
					initialitem=self.treatmentColorModelOf,
					menubutton_pady=0,
					command=self._treatmentColorModelCB)
		self.treatmentColorModelMenu.pack(side="left")

		self.treatmentSelModelVar = Tkinter.IntVar(parent)
		if self.treatmentSelModel:
			self.treatmentSelModelVar.set(1)
		else:
			self.treatmentSelModelVar.set(0)
		f = Tkinter.Frame(self.treatmentGroup.interior())
		f.pack(side="top", fill="x")
		self.treatmentSelModelButton = Tkinter.Checkbutton(f,
					text=" Choose",
					onvalue=1, offvalue=0,
					variable=self.treatmentSelModelVar,
					command=self._treatmentSelModelCB)
		self.treatmentSelModelButton.pack(side="left")
		self.treatmentSelModelMenu = Pmw.OptionMenu(f,
					items = ( "representatives",
							"all members" ),
					initialitem=self.treatmentSelModelOf,
					menubutton_pady=0,
					labelpos="e",
					label_text=" in Model Panel",
					command=self._treatmentSelModelCB)
		self.treatmentSelModelMenu.pack(side="left")

		height = min(len(self.nmrc.clusters), 10)
		values = []
		maxLength = 0
		for id in range(len(self.nmrc.clusters)):
			m = self.clusterInfo[id][0]
			n = len(self.clusterInfo[id][1])
			v = "%d (%d models, rep: %s)" % (id, n, m.oslIdent())
			values.append(v)
			if len(v) > maxLength:
				maxLength = len(v)
		self.listbox = Pmw.ScrolledListBox(self.parent,
					listbox_selectmode="extended",
					listbox_width=maxLength,
					listbox_height=height,
					selectioncommand=self._listboxSelect)
		self.listbox.pack(fill="both", expand=True)
		self.listbox.setlist(values)
    def populateListFrame(self):

        self.panelsLabel = Tkinter.Label(self.pListFrame,
                                         text="Panels",
                                         font="helvetica -14 bold")
        self.panelsLabel.grid(row=0, column=0, columnspan=4, sticky='w')

        self.panelList = Pmw.ScrolledListBox(
            self.pListFrame,
            labelmargin=10,
            listbox_height=5,
            listbox_width=20,
            listbox_selectmode=Tkinter.SINGLE,
            selectioncommand=self.refreshPanelCB,
            listbox_exportselection=False)
        #dblclickcommand=self.showPanelEntry)
        self.panelList.grid(row=1,
                            column=0,
                            padx=10,
                            columnspan=4,
                            sticky='nsew')

        this_dir = os.path.split(Demo.__file__)[0]
        self.upButton = Tkinter.Button(self.pListFrame, command=self.panelUp)
        up_image = chimage.get("arrow_up.gif", self.upButton)  #text="/\\")
        self.upButton.configure(image=up_image, state="disabled")
        self.upButton._image = up_image
        help.register(self.upButton,
                      balloon="Move currently selected panel up")
        self.upButton.grid(row=2, column=0, sticky='s')

        self.downButton = Tkinter.Button(self.pListFrame,
                                         command=self.panelDown)
        down_image = chimage.get("arrow_down.gif",
                                 self.downButton)  #text="/\\")
        self.downButton.configure(image=down_image, state="disabled")
        self.downButton._image = down_image
        help.register(self.downButton,
                      balloon="Move currently selected panel down")
        self.downButton.grid(row=3, column=0, sticky='n')

        self.deleteButton = Tkinter.Button(self.pListFrame,
                                           text="Delete",
                                           command=self.deletePanel,
                                           state="disabled")
        help.register(self.deleteButton,
                      balloon="Delete currently selected panel")
        self.deleteButton.grid(row=2, column=1, rowspan=2)

        self.newButton = Tkinter.Button(self.pListFrame,
                                        text="New",
                                        command=self.newPanelCB)
        help.register(self.newButton, balloon="Add a new panel")
        self.newButton.grid(row=2, column=2, rowspan=2)

        #self.editGlobalB = Tkinter.Button(self.pListFrame, text="Edit Demo Options",
        #                                  command=self.editGlobalCB)
        #help.register(self.editGlobalB, balloon="Edit global options for Demo")
        #self.editGlobalB.grid(row=4,column=0,columnspan=4, sticky='w')

        self.pListFrame.rowconfigure(0, weight=1)
        self.pListFrame.rowconfigure(1, weight=20)
        self.pListFrame.rowconfigure(2, weight=1)
        self.pListFrame.rowconfigure(3, weight=1)
        self.pListFrame.rowconfigure(4, weight=1)
Beispiel #20
0
    def fillInUI(self, parent):
        """fillInUI(parnet)
        """

        row = 0

        # airs frame
	af = Tkinter.Frame(parent, bd=2, padx=5, pady=10, relief='flat')
	af.grid(row=row, column=0, sticky='ew')

	# airs button
##	afb = Tkinter.Button(af, text="   AIRS   ",
##                             font=('Tempus Sans ITC', '36', 'bold'),
##                             background='black', foreground='white',
##                             activebackground='black',
##                             activeforeground='red',
##                             command=self.airs_info)
##	afb.grid(row=0, column=0, sticky='ew')

        # airs icon
        from chimera import chimage
        import os.path
        thisfile = os.path.abspath(__file__)
        thisdir  = os.path.dirname(thisfile)
        icon = chimage.get(os.path.join(thisdir, 'airs-small.gif'),parent)

        row = row + 1
        afi = Tkinter.Label(parent, image=icon, borderwidth=10)
        afi.__image = icon
        afi.grid(row=1, column=0, sticky='ew')
        
        # notebooks frame
        row = row + 1        
        nbf = Tkinter.Frame(parent)
        nbf.grid(row=row, column=0, sticky='nw')
        
        nb = Pmw.NoteBook(nbf)
        nb.pack(expand=1, fill=Tkinter.BOTH)
        self.notebook = nb
        
        nb.add('filters', tab_text='Filters')
        self.filtersFrame = nb.page('filters')

        nb.add('docking', tab_text='Docking')
        self.dockingFrame = nb.page('docking')

        nb.add('analysis', tab_text='Analysis')
        self.analysisFrame = nb.page('analysis')

        nb.add('segment', tab_text = 'Segment')
        self.segmentFrame = nb.page('segment')

        nb.add('segmisc', tab_text = 'Segment Misc')
        self.segmentMiscFrame = nb.page('segmisc')

        nb.add('misc', tab_text='Misc.')
        self.miscFrame = nb.page('misc')
        
        # filters page

        fp = Tkinter.Frame(self.filtersFrame)
        fp.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=1)

        rowfp = 0
        fpfilter = Tkinter.Button(fp, text='EMAN Filters',
                                  command=self.filters_dialog)
        fpfilter.grid(row=rowfp,column=0,sticky='nsew')

        # segment page

        sp = Tkinter.Frame(self.segmentFrame)
        sp.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=1)

        rowsp = 0
        spsimple = Tkinter.Button(sp, text='Segment Simple',
                                  command=self.seg_simple_dialog)
        spsimple.grid(row=rowsp,column=0,sticky='nsew')

        rowsp = rowsp + 1
        spmarker = Tkinter.Button(sp, text='Segment Markers',
                                  command=self.seg_marker_dialog)
        spmarker.grid(row=rowsp,column=0,sticky='nsew')

        rowsp = rowsp + 1
        spmask = Tkinter.Button(sp, text='Segment Mask',
                                command=self.seg_mask_dialog)
        spmask.grid(row=rowsp,column=0,sticky='nsew')
        
        rowsp = rowsp + 1
        spread = Tkinter.Button(sp, text='Segment Read',
                                command=self.seg_read_dialog)
        spread.grid(row=rowsp,column=0,sticky='nsew')
        
        rowsp = rowsp + 1
        spwrite = Tkinter.Button(sp, text='Segment Write',
                                 command=self.seg_write_dialog)
        spwrite.grid(row=rowsp,column=0,sticky='nsew')
        
        # segment misc page

        smp = Tkinter.Frame(self.segmentMiscFrame)
        smp.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=1)

        rowsmp = 0
        smpmeasurestick = Tkinter.Button(smp, text='Measure Stick',
                                command=self.measure_stick_dialog)
        smpmeasurestick.grid(row=rowsmp,column=0,sticky='nsew')


        rowsmp = rowsmp + 1
        smptrackxf = Tkinter.Button(smp, text='Segment Track',
                                command=self.track_xform_dialog)
        smptrackxf.grid(row=rowsmp,column=0,sticky='nsew')

        # docking page

        dp = Tkinter.Frame(self.dockingFrame)
        dp.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=1)

        rowdp = 0
        dpfh = Tkinter.Button(dp, text='Foldhunter',
                              command=self.foldhunter_dialog)
        dpfh.grid(row=rowdp,column=0,sticky='nsew')

        rowdp = rowdp + 1
        dpffh = Tkinter.Button(dp, text='Flexible Foldhunter',
                               command=self.flex_foldhunter_dialog)
        dpffh.grid(row=rowdp,column=0,sticky='nsew')

        rowdp = rowdp + 1
        dpmanual = Tkinter.Button(dp, text='Manual Docking',
                                  command=self.dock_manual_dialog)
        dpmanual.grid(row=rowdp,column=0,sticky='nsew')

        # analysis page

        ap = Tkinter.Frame(self.analysisFrame)
        ap.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=1)

        rowap = 0
        aphh = Tkinter.Button(ap, text='Classic Helixhunter',
                              command=self.helixhunter_dialog)
        aphh.grid(row=rowap,column=0,sticky='nsew')

        rowap = rowap + 1
        apsseh = Tkinter.Button(ap, text='SSE Hunter',
                                command=self.ssehunter_dialog)
        apsseh.grid(row=rowap,column=0,sticky='nsew')

        rowap = rowap + 1
        apsseb = Tkinter.Button(ap, text='SSE Builder',
                                command=self.ssebuilder_dialog)
        apsseb.grid(row=rowap,column=0,sticky='nsew')

        # misc. page

        mp = Tkinter.Frame(self.miscFrame)
        mp.pack(side=Tkinter.TOP, fill=Tkinter.X, expand=1)

        rowmp = 0
        mpmodeview = Tkinter.Button(mp, text='Mode Viewer',
                                    command=self.modeviewer_dialog)
        mpmodeview.grid(row=rowmp,column=0,sticky='nsew')

        rowmp = rowmp + 1
        mprt = Tkinter.Button(mp, text='Rotate n Translate',
                              command=self.rot_trans_dialog)
        mprt.grid(row=rowmp,column=0,sticky='nsew')

##        rowmp = rowmp + 1
##        mpskeleton = Tkinter.Button(mp, text='Skeleton',
##                                    command=self.skeleton_dialog)
##        mpskeleton.grid(row=rowmp,column=0,sticky='nsew')

        rowmp = rowmp + 1
        mppdb2mrc = Tkinter.Button(mp, text='PDB to MRC',
                                   command=self.pdb2mrc_dialog)
        mppdb2mrc.grid(row=rowmp,column=0,sticky='nsew')

        rowmp = rowmp + 1
        mpcmm2pdb = Tkinter.Button(mp, text='CMM to PDB',
                                   command=self.cmm2pdb_dialog)
        mpcmm2pdb.grid(row=rowmp,column=0,sticky='nsew')

        rowmp = rowmp + 1
        mppdb2cmm = Tkinter.Button(mp, text='PDB to CMM',
                                   command=self.pdb2cmm_dialog)
        mppdb2cmm.grid(row=rowmp,column=0,sticky='nsew')
Beispiel #21
0
    def fillInUI(self, parent):
        import Pmw, Tkinter
        from chimera import chimage
        self.parent = parent

        d = prefs.get("treatment", {})
        self.treatmentShow = d.get("show", 0)
        self.treatmentSelAtom = d.get("selectAtoms", 0)
        self.treatmentSelAtomOf = d.get("selectAtomsOf", "all members")
        self.treatmentSelModel = d.get("selectModels", 1)
        self.treatmentSelModelOf = d.get("selectModelsOf", "all members")
        self.treatmentColorModel = d.get("colorModels", 1)
        self.treatmentColorModelOf = d.get("colorModelsOf", "all members")

        self.rightArrow = chimage.get("rightarrow.png", parent)
        self.downArrow = chimage.get("downarrow.png", parent)

        if self.treatmentShow:
            relief = "sunken"
            image = self.downArrow
        else:
            relief = "flat"
            image = self.rightArrow
        self.treatmentGroup = Pmw.Group(
            parent,
            collapsedsize=0,
            tagindent=0,
            ring_relief=relief,
            tag_pyclass=Tkinter.Button,
            tag_text=" Treatment of Chosen Clusters",
            tag_relief="flat",
            tag_compound="left",
            tag_image=image,
            tag_command=self._treatmentCB)
        if not self.treatmentShow:
            self.treatmentGroup.collapse()
        self.treatmentGroup.pack(side="top", fill="x", padx=3)

        self.treatmentSelAtomVar = Tkinter.IntVar(parent)
        if self.treatmentSelAtom:
            self.treatmentSelAtomVar.set(1)
        else:
            self.treatmentSelAtomVar.set(0)
        f = Tkinter.Frame(self.treatmentGroup.interior())
        f.pack(side="top", fill="x")
        self.treatmentSelAtomButton = Tkinter.Checkbutton(
            f,
            text=" Select atoms of",
            onvalue=1,
            offvalue=0,
            variable=self.treatmentSelAtomVar,
            command=self._treatmentSelAtomCB)
        self.treatmentSelAtomButton.pack(side="left")
        self.treatmentSelAtomMenu = Pmw.OptionMenu(
            f,
            items=("representatives", "all members"),
            initialitem=self.treatmentSelAtomOf,
            menubutton_pady=0,
            command=self._treatmentSelAtomCB)
        self.treatmentSelAtomMenu.pack(side="left")

        self.treatmentColorModelVar = Tkinter.IntVar(parent)
        if self.treatmentColorModel:
            self.treatmentColorModelVar.set(1)
        else:
            self.treatmentColorModelVar.set(0)
        f = Tkinter.Frame(self.treatmentGroup.interior())
        f.pack(side="top", fill="x")
        self.treatmentColorModelButton = Tkinter.Checkbutton(
            f,
            text=" Color",
            onvalue=1,
            offvalue=0,
            variable=self.treatmentColorModelVar,
            command=self._treatmentColorModelCB)
        self.treatmentColorModelButton.pack(side="left")
        self.treatmentColorModelMenu = Pmw.OptionMenu(
            f,
            items=("representatives", "all members"),
            initialitem=self.treatmentColorModelOf,
            menubutton_pady=0,
            command=self._treatmentColorModelCB)
        self.treatmentColorModelMenu.pack(side="left")

        self.treatmentSelModelVar = Tkinter.IntVar(parent)
        if self.treatmentSelModel:
            self.treatmentSelModelVar.set(1)
        else:
            self.treatmentSelModelVar.set(0)
        f = Tkinter.Frame(self.treatmentGroup.interior())
        f.pack(side="top", fill="x")
        self.treatmentSelModelButton = Tkinter.Checkbutton(
            f,
            text=" Choose",
            onvalue=1,
            offvalue=0,
            variable=self.treatmentSelModelVar,
            command=self._treatmentSelModelCB)
        self.treatmentSelModelButton.pack(side="left")
        self.treatmentSelModelMenu = Pmw.OptionMenu(
            f,
            items=("representatives", "all members"),
            initialitem=self.treatmentSelModelOf,
            menubutton_pady=0,
            labelpos="e",
            label_text=" in Model Panel",
            command=self._treatmentSelModelCB)
        self.treatmentSelModelMenu.pack(side="left")

        height = min(len(self.nmrc.clusters), 10)
        values = []
        maxLength = 0
        for id in range(len(self.nmrc.clusters)):
            m = self.clusterInfo[id][0]
            n = len(self.clusterInfo[id][1])
            v = "%d (%d models, rep: %s)" % (id, n, m.oslIdent())
            values.append(v)
            if len(v) > maxLength:
                maxLength = len(v)
        self.listbox = Pmw.ScrolledListBox(
            self.parent,
            listbox_selectmode="extended",
            listbox_width=maxLength,
            listbox_height=height,
            selectioncommand=self._listboxSelect)
        self.listbox.pack(fill="both", expand=True)
        self.listbox.setlist(values)