Beispiel #1
0
def _bgCheckColor(cat, opt, c):
    oc = preferences.get(cat, opt)
    if c is None:
        if oc is not None:
            preferences.set(cat, opt, None)
    else:
        nc = c.rgba()
        if oc != nc:
            preferences.set(cat, opt, nc)
Beispiel #2
0
def download_license():
    url = "https://www.happymac.app/_functions/agree/?token=%s" % get_hardware_uuid(
    )
    log.log("Getting license from: %s" % url)
    license = requests.get(url).content
    key = json.loads(license)["key"]
    log.log("Received license key: %s" % key)
    preferences.set("license", key)
    return key
Beispiel #3
0
def _bgCheckColor(cat, opt, c):
	oc = preferences.get(cat, opt)
	if c is None:
		if oc is not None:
			preferences.set(cat, opt, None)
	else:
		nc = c.rgba()
		if oc != nc:
			preferences.set(cat, opt, nc)
	def _updateUsePrint(self):
		usePrint = self.usePrint.get()
		preferences.set(IMAGE_SETUP, USE_PRINT_UNITS, usePrint)
		if not usePrint:
			values = ['pixels']
		else:
			values = convert.keys()
			try:
				values.remove('pixels')
			except ValueError:
				pass
			values.sort()
		self.units.values = values
		self.units.remakeMenu()
		if usePrint:
			self.units.set('inches')
		else:
			self.units.set('pixels')
		self.updateImageUnits()
		if not usePrint:
			self.fetchWindowSize()
def checkPovrayLicense():
	if preferences.get(POVRAY_AGREE, LICENSE_AGREE):
		return True
	if not chimera.nogui:
		dialog = PovrayCheckLicense()
		agree = dialog.run(chimera.tkgui.app)
	else:
		text = PovrayLicenseText()
		if text:
			text = ("You must read and accept the following"
				" license agreement before raytracing an image"
				" with POV-Ray:\n\n") + text
		if not text:
			text = "You must read and accept the POV-Ray End-User License at <http://www.povray.org/povlegal.html>."
		print text
		import sys
		sys.stdout.write("\nDo you agree to the Pov-Ray End-User License (y/n)? [n] ")
		yesno = sys.stdin.readline() 
		agree = yesno[0] in "yY"
	preferences.set(POVRAY_AGREE, LICENSE_AGREE, agree)
	return agree
	def updateImageUnits(self, *args):
		units = self.units.get()
		if units == 'pixels':
			self.printRes.disable()
			self.adjustFOV.disable()
		else:
			self.printRes.enable()
			self.adjustFOV.enable()
		if units != preferences.get(IMAGE_SETUP, UNITS):
			preferences.set(IMAGE_SETUP, UNITS, units)
		try:
			adjust = convert[units]
		except KeyError:
			adjust = -1
		if adjust == self.adjust:
			return
		if self.adjust != -1 and adjust != -1:
			factor = self.adjust / adjust
			w = self.iWidth.get() * factor
			self.iWidth.set(w)
			h = self.iHeight.get() * factor
			self.iHeight.set(h)
		if adjust == -1:
			# entering pixel mode
			w, h = chimera.viewer.windowSize
			self.iWidth.set(w)
			self.iHeight.set(h)
		elif self.adjust == -1:
			pass
			# leaving pixel mode, sanity check
			#w, h = paper_types[preferences.get(PAGE_SETUP, PAPER_TYPE)]
			#if self.iWidth.get() > w:
			#	self.iWidth.set(w)
			#if self.iHeight.get() > h:
			#	self.iHeight.set(h)
		self.adjust = adjust
		self._computeMaxLineWidth()
Beispiel #7
0
def set_suspend_preference(name, value):
    preferences.set("suspend - %s" % name, value)
Beispiel #8
0
def _bgCheckOpt(cat, opt, b):
    ob = preferences.get(cat, opt)
    if ob != b:
        preferences.set(cat, opt, b)
Beispiel #9
0
import utils
import os
import preferences

APP_LOCATION = "/Applications/tempo.app"
SETUP_SCRIPT = 'tell application "System Events" to make login item at end with properties {path:"%s", hidden:false}' % APP_LOCATION
LAUNCH_AT_LOGIN_KEY = "ENABLE_LAUNCH_AT_LOGIN"

if os.path.exists(APP_LOCATION):
    if preferences.get(LAUNCH_AT_LOGIN_KEY):
        preferences.set(LAUNCH_AT_LOGIN_KEY, "true")
        utils.run_osa_script(SETUP_SCRIPT)

Beispiel #10
0
def _bgCheckOpt(cat, opt, b):
	ob = preferences.get(cat, opt)
	if ob != b:
		preferences.set(cat, opt, b)
	def _updateSS(self, option):
		ss = option.get()
		preferences.set(IMAGE_SETUP, SUPERSAMPLE, ss)
		self._computeMaxLineWidth()
	def _updateAdjustFOV(self, option):
		adjust = option.get()
		preferences.set(IMAGE_SETUP, ADJUST_FOV, adjust)
	def _updatePrint(self, option):
		res = option.get()
		preferences.set(IMAGE_SETUP, DPI, res)
Beispiel #14
0
 def test_set(self, mock_log):
     mock_log.return_value = None
     self.assertEqual(
         preferences.set(value=True, key='suspend - qemu-system-i386'),
         None)
def _statusLineShownCB(trigName, x, shown):
    import preferences
    preferences.set(REPLY_PREFERENCES, SHOW_STATUS_LINE, shown)
Beispiel #16
0
def _statusLineShownCB(trigName, x, shown):
	import preferences
	preferences.set(REPLY_PREFERENCES, SHOW_STATUS_LINE, shown)