示例#1
0
 def as_icon(cls, molecules=None, size=None):
     if size is None:
         size = preferences.get('tangram_snfg', 'icon_size')
     return cls(size=size,
                connect=False,
                molecules=molecules,
                hide_residue=False)
 def addItem(self, dir):
     from chimera import tkgui
     if preferences.get(tkgui.GENERAL, tkgui.PATH_STYLE) == tkgui.PATH_NEXT:
         path, name = os.path.split(dir)
         OrderedListOption.addItem(self, "%s - %s" % (name, path), dir)
     else:
         OrderedListOption.addItem(self, dir, dir)
示例#3
0
def _proxyChangeCB(opt=None):
	if opt is None:
		doProxy = preferences.get(WEBACCESS_PREF, WA_PROXY)
	else:
		doProxy = opt.get()
	import os
	if doProxy:
		os.environ['http_proxy'] = "http://" + preferences.get(WEBACCESS_PREF, WA_PROXY_HOST) + ":" + str(preferences.get(WEBACCESS_PREF, WA_PROXY_PORT))
		os.environ['HTTP_PROXY'] = os.environ['http_proxy']
	else:
		try:
			del os.environ['http_proxy']
			del os.environ['HTTP_PROXY']
		except KeyError:
			pass
	import urllib
	urllib._urlopener = None # clear cached instance
示例#4
0
def _init():
	preferences.register(WEBACCESS_PREF, _webAccessPrefs)
	preferences.setOrder(WEBACCESS_PREF, _waPreferencesOrder)
	from DBPuppet import run_puppet
	if sys.platform == 'darwin':
		run_puppet(True)
	else:
		onoff = preferences.get(WEBACCESS_PREF, WA_ACCEPT_DATA)
		run_puppet(onoff)
示例#5
0
	def addItem(self, dir):
		from chimera import tkgui
		if preferences.get(tkgui.GENERAL,
					tkgui.PATH_STYLE) == tkgui.PATH_NEXT:
			path, name = os.path.split(dir)
			OrderedListOption.addItem(self,
						"%s - %s" % (name, path), dir)
		else:
			OrderedListOption.addItem(self, dir, dir)
示例#6
0
def background_color():

    from chimera import preferences
    from chimera import bgprefs
    rgba = preferences.get(bgprefs.BACKGROUND, bgprefs.BG_COLOR)
    if not rgba:
        rgba = (0, 0, 0, 1)
    rgb = rgba[:3]
    return chimera_color(rgb)
示例#7
0
def background_color():

  from chimera import preferences
  from chimera import bgprefs
  rgba = preferences.get(bgprefs.BACKGROUND, bgprefs.BG_COLOR)
  if not rgba:
    rgba = (0,0,0,1)
  rgb = rgba[:3]
  return chimera_color(rgb)
示例#8
0
 def as_full(cls,
             molecules=None,
             size=None,
             cylinder_radius=None,
             connect=None,
             bondtypes=None):
     if size is None:
         size = preferences.get('tangram_snfg', 'full_size')
     if cylinder_radius is None:
         cylinder_radius = preferences.get('tangram_snfg',
                                           'cylinder_radius')
     if connect is None:
         connect = preferences.get('tangram_snfg', 'connect')
     if bondtypes is None:
         bondtypes = preferences.get('tangram_snfg', 'bondtypes')
     return cls(size=size,
                cylinder_radius=cylinder_radius,
                cylinder_redfac=0,
                sphere_redfac=0,
                molecules=molecules,
                hide_residue=True,
                connect=connect,
                bondtypes=bondtypes)
示例#9
0
 def add(self, item):
     self.listbox.insert('end', item)
     self.listbox.see('end')
     self.listbox.select_clear(0, 'end')
     self.listbox.select_set('end')
     commands = list(self.listbox.get())
     last9 = commands[-9:]
     last9.reverse()
     c = self.controller
     c.cmd.setlist(last9 + [c.recordLabel, c.hideLabel])
     numRemember = preferences.get(MIDAS_CATEGORY, SES_MEMORY)
     if numRemember:
         prefs[PREV_COMMANDS] = commands[-numRemember:]
     else:
         prefs[PREV_COMMANDS] = []
示例#10
0
    def __init__(self):
        from chimera import tkgui
        self.frame = Tkinter.Frame(tkgui.app)
        self.frame.columnconfigure(1, weight=1)
        help.register(self.frame, "UsersGuide/chimerawindow.html#emulator")

        sep = Tkinter.Frame(self.frame, relief='sunken', bd=2)
        sep.grid(row=0, column=0, columnspan=3, sticky='ew')

        self.histDialog = HistoryDialog(self)
        listbox = self.histDialog.listbox.component('listbox')
        import tkFont
        font = tkFont.Font(font=listbox.cget('font'))
        pixels = font.metrics('linespace')
        self.cmd = Pmw.ComboBox(
            self.frame,
            fliparrow=True,
            history=False,
            labelpos='w',
            label_text="Command:",
            listheight=10 * (pixels + 4),
            entry_exportselection=False,
            selectioncommand=self._selCmdCB,
            scrolledlist_items=[self.recordLabel, self.hideLabel])
        self.cmd.grid(row=1, column=0, columnspan=3, sticky='ew')
        self.histDialog.populate()

        chimera.tkgui.addKeyboardFunc(self.graphicsKeyboardCB)

        entry = self.cmd.component('entry')
        entry.bind('<Up>', self.histDialog.up)
        entry.bind('<Control-p>', self.histDialog.up)
        entry.bind('<Down>', self.histDialog.down)
        entry.bind('<Control-n>', self.histDialog.down)
        entry.bind('<Map>', self.monitorSel)
        entry.bind('<Unmap>', self.unmonitorSel)
        entry.bind('<Control-u>', self.cmdClear)
        entry.bind('<Return>', self.processCommand)

        self.vars = []
        self.buttons = []
        buttonFrame = Tkinter.Frame(self.frame)
        buttonFrame.grid(row=2, column=0, columnspan=3, sticky='ew')
        Tkinter.Label(buttonFrame, text="Active models: ").pack(side='left')
        for id in range(10):
            state = 'disabled'
            active = 0
            models = chimera.openModels.list(id)
            models = filter(
                lambda m: not isinstance(m, chimera.PseudoBondGroup), models)
            if models:
                state = 'normal'
                if models[0].openState.active:
                    active = 1

            var = Tkinter.IntVar(self.frame)
            self.vars.append(var)
            var.set(active)
            selButton = Tkinter.Checkbutton(
                buttonFrame,
                variable=var,
                state=state,
                text="%d" % id,
                command=lambda x=id, s=self: s.selButtonPush(x))
            selButton.pack(side='left')
            self.buttons.append(selButton)
        self.allVar = Tkinter.IntVar(self.frame)
        self.allVar.set(0)
        self.allButton = Tkinter.Checkbutton(buttonFrame,
                                             text="All",
                                             variable=self.allVar,
                                             command=self.allButtonPush)
        self.allButton.pack(side='left')

        chimera.triggers.addHandler('OpenState', self.activeHandler, None)
        chimera.triggers.addHandler('OpenModels', self.activeHandler, None)

        self.show()

        # read startup files
        global ui
        ui = self
        for sf in preferences.get(MIDAS_CATEGORY, STARTUP_FILES):
            from OpenSave import tildeExpand
            sf = tildeExpand(sf)
            if os.path.exists(sf):
                midas_text.message("Processing Midas start-up file %s" % sf)
                midas_text.processCommandFile(sf)
示例#11
0
def get_preferences():
    return preferences.get('tangram_nciplot', 'nciplot_bin'), \
           preferences.get('tangram_nciplot', 'nciplot_dat')