本文整理汇总了Python中mojo.extensions.setExtensionDefault函数的典型用法代码示例。如果您正苦于以下问题:Python setExtensionDefault函数的具体用法?Python setExtensionDefault怎么用?Python setExtensionDefault使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setExtensionDefault函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: previewCallback
def previewCallback(self, sender):
value = sender.get()
self.w.fill.enable(value)
self.w.stroke.enable(value)
self.w.color.enable(value)
setExtensionDefault("%s.%s" % (outlinePaletteDefaultKey, "preview"), value)
self.updateView()
示例2: windowCloseCallback
def windowCloseCallback(self, sender):
removeObserver(self, "draw")
removeObserver(self, "drawInactive")
removeObserver(self, "currentGlyphChanged")
setExtensionDefault("%s.%s" % (extensionID, "tension"), self.w.HobbySlider.get())
super(metapolator, self).windowCloseCallback(sender)
UpdateCurrentGlyphView()
示例3: resetCallback
def resetCallback(self, sender):
if self.w.tabs.get() == 0:
self.settings.set(None)
else:
setExtensionDefault("%s.htmlPreview" % settingsIdentifier, htmlPreviewDefault)
self.html.set(htmlPreviewDefault)
setExtensionDefault("%s.globalCSSPreview" % settingsIdentifier, "")
self.globalCss.set("")
示例4: saveCallback
def saveCallback(self, sender):
data = {
"threaded": self.w.threaded.get(),
"exportInFolders": self.w.exportInFolders.get(),
"keepFileNames": self.w.keepFileNames.get()
}
setExtensionDefault(self.identifier, data)
self.closeCallback(sender)
示例5: saveComponentList
def saveComponentList(self):
# Save the component list as an extension user default, just without the component objects.
cleanedComponentList = []
for component in self.components:
cleanedComponentList.append(
{"type": component["type"],
"name": component["name"],
"pins": component["pins"],
"object": None,
"problem": True})
setExtensionDefault("lastComponentList", cleanedComponentList)
示例6: closeCallback
def closeCallback(self, sender):
overWrite = self.w.overWrite.get()
markColor = None
if self.w.markGlyphs.get():
markColor = self.w.markGlyphColor.get()
setExtensionDefault(self.overWriteKey, overWrite)
setExtensionDefault(self.useMarkColorKey, bool(markColor))
if markColor is not None:
setExtensionDefaultColor(self.markColorKey, markColor)
self.w.close()
示例7: gridInputCallback
def gridInputCallback(self, sender):
value = sender.get()
## must be int
try:
value = int(value)
except:
value = self.tool.size
sender.set(value)
return
self.tool.size = value
setExtensionDefault(GRID_DEFAULTS_KEY, value)
示例8: get_folder_callback
def get_folder_callback(self, sender):
folder = getFolder(
messageText='choose a folder for the output files',
title=self.title,
allowsMultipleSelection=False)
if folder is not None:
folder = folder[0]
if len(folder) > 0:
self.folder = folder
if os.path.exists(self.folder):
setExtensionDefault('%s.folder' % self.extension_key, self.folder)
self.w.folder_status.set('%s' % unichr(10003))
示例9: get_otf_2_callback
def get_otf_2_callback(self, sender):
otf_2 = getFile(
messageText='choose a first .otf font',
title=self.title,
allowsMultipleSelection=False)
if otf_2 is not None:
otf_2 = otf_2[0]
if len(otf_2) > 0:
self.otf_2 = otf_2
if os.path.exists(self.otf_2):
setExtensionDefault('%s.otf_2' % self.extension_key, self.otf_2)
self.w.otf_2_status.set('%s' % unichr(10003))
示例10: replaceSuffixes
def replaceSuffixes(self, sender):
""" Handle replacing/appending of suffixes. """
mode = "replace" if self.w.replace.get() == 1 else "append"
oldSuffix = self.w.oldSuffix.getItems()[self.w.oldSuffix.get()]
enteredSuffix = self.w.newSuffix.get()
suffixes_in = [oldSuffix, enteredSuffix]
suffixes = [] # build proper suffixes list
for s in suffixes_in:
if s is not None and len(s) > 0:
if s[0] == ".":
s = s[1:] # handle suffixes without periods
suffixes.append(s)
if mode == "replace" and suffixes[0] == suffixes[1]:
Message(u"Cannot replace a suffix with itself.\nI mean I could, but there seems to be little point :)")
elif mode == "append" and suffixes[1] == "":
Message(u"Cannot append an empty suffix.\n(Or you could just pretend I've already done it.)")
else:
scope = self.f.keys() if self.w.scope.get() == 1 else self.f.selection
if mode == "replace":
for gname in scope:
if gname.endswith(suffixes[0]):
sufLen = len(suffixes[0])
if len(suffixes[1]) > 0:
newName = gname[:-sufLen] + suffixes[1]
else:
sufLenWithPeriod = sufLen+1
newName = gname[:-sufLenWithPeriod]
self._changeGlyphname(gname, newName)
elif mode == "append":
for gname in scope:
newName = gname + "." + suffixes[1]
self._changeGlyphname(gname, newName)
self.f.autoUnicodes()
self.f.update()
# store new values as defaults
savedPresets = getExtensionDefault("nl.typologic.suffixer.presetSuffixes")
if enteredSuffix != "" and enteredSuffix not in savedPresets:
savedPresetsList = savedPresets.split()
savedPresetsList.append(enteredSuffix)
savedPresetsList.sort()
newPresets = " ".join(savedPresetsList)
setExtensionDefault("nl.typologic.suffixer.presetSuffixes", newPresets)
self.w.close()
示例11: save
def save(self):
setExtensionDefault(onOffKey, self.onOff)
setExtensionDefault(lineWidthKey, self.lineWidth)
setExtensionDefaultColor(lineColorKey, self.lineColor)
setExtensionDefaultColor(fillColorKey, self.fillColor)
setExtensionDefault(lineRGBA, self.lineRGBA)
setExtensionDefault(fillRGBA, self.fillRGBA)
示例12: windowCloseCallback
def windowCloseCallback(self, sender):
removeObserver(self, "draw")
removeObserver(self, "drawInactive")
#removeObserver(self, "currentGlyphChanged")
setExtensionDefault("%s.%s" % (extensionID, "method"), self.w.eqMethodSelector.get())
setExtensionDefault("%s.%s" % (extensionID, "curvature"), self.w.eqCurvatureSelector.get())
setExtensionDefault("%s.%s" % (extensionID, "curvatureFree"), self.w.eqCurvatureSlider.get())
setExtensionDefault("%s.%s" % (extensionID, "tension"), self.w.eqHobbyTensionSlider.get())
super(CurveEqualizer, self).windowCloseCallback(sender)
UpdateCurrentGlyphView()
示例13: toggle_panels
def toggle_panels():
'''Show/hide all floating windows in the current workspace.'''
# get panels
windows = NSApp.windows()
panels = [ window for window in windows if isinstance(window, NSPanel) ]
# get state
show_panels = getExtensionDefault('com.hipertipo.showHidePanels', fallback=True)
# hide panels
if show_panels:
for panel in panels:
panel.orderOut_(None)
setExtensionDefault('com.hipertipo.showHidePanels', False)
# show panels
if show_panels is False:
for panel in panels:
if str(type(panel)) != '<objective-c class NSColorPanel at 0x7fff750fad60>':
panel.orderBack_(None)
setExtensionDefault('com.hipertipo.showHidePanels', True)
示例14: okCallback
def okCallback(self, sender):
userName = self.w.userName.get()
password = self.w.password.get()
twit = TwitPicAPI(userName, password)
i = self.w.view.get()
viewName = self._viewNames[i]
image = self.getImageForView(viewName)
if image is None:
self.showMessage("Oeps!", "Open a glyph window or space center window")
return
message = self.w.message.get()
status = twit.upload(image, "%s #robofont" %message, post_to_twitter=True)
if status == 1001:
self.showMessage("Oeps!", "Invalid user or password")
elif status in [1002, 1003, 1004]:
self.showMessage("Oeps!", "An error occured 'somewhere', try again")
else:
self.showMessage("Send to Twitter", "%s" %status)
setExtensionDefault("%s.%s" %(defaultKey, "userName"), userName)
setExtensionDefault("%s.%s" %(defaultKey, "password"), password)
示例15: saveDefaults
def saveDefaults(self, sender):
for setting in self.webSettings:
key = setting.replace(" ", "_").lower()
value = getattr(self, key).get()
setExtensionDefault("%s.%s" % (settingsIdentifier, key), value)
if "Woff" in setting:
value = getattr(self, "%s_format" % key).get()
setExtensionDefault("%s.format_%s" % (settingsIdentifier, key), value)
for key in ["webSuffix", "preserveTTFhints", "generateHTML"]:
value = getattr(self, key).get()
setExtensionDefault("%s.%s" % (settingsIdentifier, key), value)