本文整理汇总了Python中taskcoachlib.operating_system.isWindows函数的典型用法代码示例。如果您正苦于以下问题:Python isWindows函数的具体用法?Python isWindows怎么用?Python isWindows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isWindows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnInit
def OnInit(self):
if operating_system.isWindows():
self.Bind(wx.EVT_QUERY_END_SESSION, self.onQueryEndSession)
try:
isatty = sys.stdout.isatty()
except AttributeError:
isatty = False
if (operating_system.isWindows() and hasattr(sys, 'frozen') and not isatty) or not isatty:
sys.stdout = sys.stderr = RedirectedOutput()
return True
示例2: __is_scrollbar_included_in_client_size
def __is_scrollbar_included_in_client_size(self):
# NOTE: on GTK, the scrollbar is included in the client size, but on
# Windows it is not included
if operating_system.isWindows():
return isinstance(self, hypertreelist.HyperTreeList)
else:
return True
示例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: __create_mutex
def __create_mutex():
''' On Windows, create a mutex so that InnoSetup can check whether the
application is running. '''
if operating_system.isWindows():
import ctypes
from taskcoachlib import meta
ctypes.windll.kernel32.CreateMutexA(None, False, meta.filename)
示例5: summary
def summary(self):
if self.__handle is not None:
self.close()
if operating_system.isWindows():
wx.MessageBox(_('Errors have occured. Please see "taskcoachlog.txt" in your "My Documents" folder.'), _('Error'), wx.OK)
else:
wx.MessageBox(_('Errors have occured. Please see "%s"') % self.__path, _('Error'), wx.OK)
示例6: 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('~')
示例7: migrateConfigurationFiles
def migrateConfigurationFiles(self):
# Templates. Extra care for Windows shortcut.
oldPath = self.pathToTemplatesDir_deprecated(doCreate=False)
newPath, exists = self._pathToTemplatesDir()
if self.__iniFileSpecifiedOnCommandLine:
globalPath = os.path.join(self.pathToDataDir(forceGlobal=True), 'templates')
if os.path.exists(globalPath) and not os.path.exists(oldPath):
# Upgrade from fresh installation of 1.3.24 Portable
oldPath = globalPath
if exists and not os.path.exists(newPath + '-old'):
# WTF?
os.rename(newPath, newPath + '-old')
exists = False
if exists:
return
if oldPath != newPath:
if operating_system.isWindows() and os.path.exists(oldPath + '.lnk'):
shutil.move(oldPath + '.lnk', newPath + '.lnk')
elif os.path.exists(oldPath):
# pathToTemplatesDir() has created the directory
try:
os.rmdir(newPath)
except:
pass
shutil.move(oldPath, newPath)
# Ini file
oldPath = os.path.join(self.pathToConfigDir_deprecated(environ=os.environ), '%s.ini' % meta.filename)
newPath = os.path.join(self.pathToConfigDir(environ=os.environ), '%s.ini' % meta.filename)
if newPath != oldPath and os.path.exists(oldPath):
shutil.move(oldPath, newPath)
# Cleanup
try:
os.rmdir(self.pathToConfigDir_deprecated(environ=os.environ))
except:
pass
示例8: init
def init():
if operating_system.isWindows() and wx.DisplayDepth() >= 32:
wx.SystemOptions_SetOption("msw.remap", "0") # pragma: no cover
try:
wx.ArtProvider_PushProvider(ArtProvider()) # pylint: disable=E1101
except AttributeError:
wx.ArtProvider.Push(ArtProvider())
示例9: OnBeginColumnDrag
def OnBeginColumnDrag(self, event):
# pylint: disable=W0201
if event.Column == self.ResizeColumn:
self.__oldResizeColumnWidth = self.GetColumnWidth(self.ResizeColumn)
# Temporarily unbind the EVT_SIZE to prevent resizing during dragging
self.Unbind(wx.EVT_SIZE)
if operating_system.isWindows():
event.Skip()
示例10: testWindowSizeShouldnotChangeWhenReceivingChangeSizeEvent
def testWindowSizeShouldnotChangeWhenReceivingChangeSizeEvent(self):
event = wx.SizeEvent((100, 20))
process = self.mainwindow.ProcessEvent
if operating_system.isWindows():
process(event) # pragma: no cover
else:
wx.CallAfter(process, event) # pragma: no cover
self.assertEqual((900, self.expectedHeight()), eval(self.settings.get("window", "size")))
示例11: setUp
def setUp(self):
super(WindowDimensionsTrackerTest, self).setUp()
self.settings = config.Settings(load=False)
self.section = "window"
self.settings.setvalue(self.section, "position", (50, 50))
self.settings.setvalue(self.section, "starticonized", "Never")
if operating_system.isWindows():
self.frame.Show()
self.tracker = gui.windowdimensionstracker.WindowDimensionsTracker(self.frame, self.settings)
示例12: testMaximize
def testMaximize(self): # pragma: no cover
# Skipping this test under wxGTK. I don't know how it managed
# to pass before but according to
# http://trac.wxwidgets.org/ticket/9167 and to my own tests,
# EVT_MAXIMIZE is a noop under this platform.
self.mainwindow.Maximize()
if operating_system.isWindows():
wx.Yield()
self.failUnless(self.settings.getboolean('window', 'maximized'))
示例13: 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
示例14: setUp
def setUp(self):
super(WindowDimensionsTrackerTest, self).setUp()
self.settings = config.Settings(load=False)
self.section = 'window'
self.settings.setvalue(self.section, 'position', (50, 50))
self.settings.setvalue(self.section, 'starticonized', 'Never')
if operating_system.isWindows():
self.frame.Show()
self.tracker = gui.windowdimensionstracker.WindowDimensionsTracker( \
self.frame, self.settings)
示例15: __register_signal_handlers
def __register_signal_handlers(self):
quit_adapter = lambda *args: self.quitApplication()
if operating_system.isWindows():
import win32api # pylint: disable=F0401
win32api.SetConsoleCtrlHandler(quit_adapter, True)
else:
import signal
signal.signal(signal.SIGTERM, quit_adapter)
if hasattr(signal, 'SIGHUP'):
forced_quit = lambda *args: self.quitApplication(force=True)
signal.signal(signal.SIGHUP, forced_quit) # pylint: disable=E1101