本文整理汇总了Python中taskcoachlib.operating_system.isMac函数的典型用法代码示例。如果您正苦于以下问题:Python isMac函数的具体用法?Python isMac怎么用?Python isMac使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isMac函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, iocontroller=None, *args, **kwargs):
self.iocontroller = iocontroller
super(SyncMLPreferences, self).__init__(bitmap='wrench_icon', *args,
**kwargs)
self.SetSize((700, -1))
if operating_system.isMac():
self.CentreOnParent()
示例2: __init__
def __init__(self, *args, **kwargs):
super(TaskReminderPage, self).__init__(columns=3, growableColumn=-1,
*args, **kwargs)
names = [] # There's at least one, the universal one
for name in notify.AbstractNotifier.names():
names.append((name, name))
self.addChoiceSetting('feature', 'notifier',
_('Notification system to use for reminders'),
'', names, flags=(None, wx.ALL | wx.ALIGN_LEFT))
if operating_system.isMac() or operating_system.isGTK():
self.addBooleanSetting('feature', 'sayreminder',
_('Let the computer say the reminder'),
_('(Needs espeak)') if operating_system.isGTK() else '',
flags=(None, wx.ALL | wx.ALIGN_LEFT,
wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL))
snoozeChoices = [(str(choice[0]), choice[1]) for choice in date.snoozeChoices]
self.addChoiceSetting('view', 'defaultsnoozetime',
_('Default snooze time to use after reminder'),
'', snoozeChoices, flags=(None,
wx.ALL | wx.ALIGN_LEFT))
self.addMultipleChoiceSettings('view', 'snoozetimes',
_('Snooze times to offer in task reminder dialog'),
date.snoozeChoices[1:],
flags=(wx.ALIGN_TOP | wx.ALL, None)) # Don't offer "Don't snooze" as a choice
self.fit()
示例3: getSimple
def getSimple(klass):
"""
Returns a notifier suitable for simple notifications. This
defaults to Growl/Snarl/libnotify depending on their
availability.
"""
if klass._enabled:
if operating_system.isMac():
return klass.get("Growl") or klass.get("Task Coach")
elif operating_system.isWindows():
return klass.get("Snarl") or klass.get("Task Coach")
else:
return klass.get("libnotify") or klass.get("Task Coach")
else:
class DummyNotifier(AbstractNotifier):
def getName(self):
return u"Dummy"
def isAvailable(self):
return True
def notify(self, title, summary, bitmap, **kwargs):
pass
return DummyNotifier()
示例4: sendMail
def sendMail(to, subject, body, cc=None, openURL=openfile.openFile):
def unicode_quote(s):
# This is like urllib.quote but leaves out Unicode characters,
# which urllib.quote does not support.
chars = [c if ord(c) >= 128 else urllib.quote(c) for c in s]
return ''.join(chars)
cc = cc or []
if isinstance(to, (str, unicode)):
to = [to]
# FIXME: Very strange things happen on MacOS X. If there is one
# non-ASCII character in the body, it works. If there is more than
# one, it fails. Maybe we should use Mail.app directly ? What if
# the user uses something else ?
if not operating_system.isMac():
body = unicode_quote(body) # Otherwise newlines disappear
cc = map(unicode_quote, cc)
to = map(unicode_quote, to)
components = ['subject=%s' % subject, 'body=%s' % body]
if cc:
components.append('cc=%s' % ','.join(cc))
openURL(u'mailto:%s?%s' % (','.join(to), '&'.join(components)))
示例5: __init__
def __init__(self):
if operating_system.isMac():
self.__binary = 'say'
elif operating_system.isGTK():
self.__binary = 'espeak'
self.__texts_to_say = []
self.__current_speech_process = None
示例6: test_change_size
def test_change_size(self):
self.frame.Maximize(False)
if operating_system.isMac():
self.frame.SetClientSize((123, 200))
else:
self.frame.ProcessEvent(wx.SizeEvent((123, 200)))
self.assertEqual((123, 200), self.settings.getvalue(self.section, "size"))
示例7: pathToDocumentsDir
def pathToDocumentsDir():
if operating_system.isWindows():
from win32com.shell import shell, shellcon
try:
return shell.SHGetSpecialFolderPath(None, shellcon.CSIDL_PERSONAL)
except:
# Yes, one of the documented ways to get this sometimes fail with "Unspecified error". Not sure
# this will work either.
# Update: There are cases when it doesn't work either; see support request #410...
try:
return shell.SHGetFolderPath(None, shellcon.CSIDL_PERSONAL, None, 0) # SHGFP_TYPE_CURRENT not in shellcon
except:
return os.getcwd() # Fuck this
elif operating_system.isMac():
import Carbon.Folder, Carbon.Folders, Carbon.File
pathRef = Carbon.Folder.FSFindFolder(Carbon.Folders.kUserDomain, Carbon.Folders.kDocumentsFolderType, True)
return Carbon.File.pathname(pathRef)
elif operating_system.isGTK():
try:
from PyKDE4.kdeui import KGlobalSettings
except ImportError:
pass
else:
return unicode(KGlobalSettings.documentPath())
# Assuming Unix-like
return os.path.expanduser('~')
示例8: test_initial_size
def test_initial_size(self):
# See MainWindowTest...
width, height = self.frame.GetSizeTuple()
if operating_system.isMac(): # pragma: no cover
width, height = self.frame.GetClientSize()
height -= 18
self.assertEqual((width, height), self.settings.getvalue(self.section, "size"))
示例9: _createSpinCtrl
def _createSpinCtrl(self, percentage):
entry = widgets.SpinCtrl(
self, value=percentage, min=0, max=100, size=(60 if operating_system.isMac() else 50, -1)
)
for eventType in wx.EVT_SPINCTRL, wx.EVT_KILL_FOCUS:
entry.Bind(eventType, self.onSpin)
return entry
示例10: __init__
def __init__(self, window, settings):
super(WindowDimensionsTracker, self).__init__(window, settings,
'window')
self.__settings = settings
if self.__start_iconized():
if operating_system.isMac() or operating_system.isGTK():
# Need to show the window on Mac OS X first, otherwise it
# won't be properly minimized. On wxGTK we need to show the
# window first, otherwise clicking the task bar icon won't
# show it.
self._window.Show()
self._window.Iconize(True)
if not operating_system.isMac() and \
self.get_setting('hidewheniconized'):
# Seems like hiding the window after it's been
# iconized actually closes it on Mac OS...
wx.CallAfter(self._window.Hide)
示例11: onTaskbarClick
def onTaskbarClick(self, event):
if self.__window.IsIconized() or not self.__window.IsShown():
self.__window.restore(event)
else:
if operating_system.isMac():
self.__window.Raise()
else:
self.__window.Iconize()
示例12: __get_agw_style
def __get_agw_style():
agw_style = wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_MULTIPLE \
| wx.TR_EDIT_LABELS | wx.TR_HAS_BUTTONS | wx.TR_FULL_ROW_HIGHLIGHT \
| customtree.TR_HAS_VARIABLE_ROW_HEIGHT
if operating_system.isMac():
agw_style |= wx.TR_NO_LINES
agw_style &= ~hypertreelist.TR_NO_HEADER
return agw_style
示例13: __init__
def __init__(self):
self.__iconCache = dict()
if operating_system.isMac():
self.__iconSizeOnCurrentPlatform = 128
elif operating_system.isGTK():
self.__iconSizeOnCurrentPlatform = 48
else:
self.__iconSizeOnCurrentPlatform = 16
示例14: __init__
def __init__(self, parent, *args, **kwargs):
super(BaseTextCtrl, self).__init__(parent, -1, *args, **kwargs)
self.__data = None
if operating_system.isGTK() or operating_system.isMac():
if operating_system.isGTK():
self.Bind(wx.EVT_KEY_DOWN, self.__on_key_down)
self.Bind(wx.EVT_KILL_FOCUS, self.__on_kill_focus)
self.__initial_value = self.GetValue()
self.__undone_value = None
示例15: OnInit
def OnInit(self):
if operating_system.isWindows():
self.Bind(wx.EVT_QUERY_END_SESSION, self.onQueryEndSession)
if (operating_system.isMac() and hasattr(sys, 'frozen')) or \
(operating_system.isGTK() and not sys.stdout.isatty()):
sys.stdout = sys.stderr = RedirectedOutput()
return True