本文整理汇总了Python中taskcoachlib.operating_system.isGTK函数的典型用法代码示例。如果您正苦于以下问题:Python isGTK函数的具体用法?Python isGTK怎么用?Python isGTK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isGTK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __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()
示例2: __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
示例3: quitApplication
def quitApplication(self, force=False):
if not self.iocontroller.close(force=force):
return False
# Remember what the user was working on:
self.settings.set('file', 'lastfile', self.taskFile.lastFilename())
self.mainwindow.save_settings()
self.settings.save()
if hasattr(self, 'taskBarIcon'):
self.taskBarIcon.RemoveIcon()
if self.mainwindow.bonjourRegister is not None:
self.mainwindow.bonjourRegister.stop()
from taskcoachlib.domain import date
date.Scheduler().shutdown()
self.__wx_app.ProcessIdle()
# For PowerStateMixin
self.mainwindow.OnQuit()
if operating_system.isGTK() and self.sessionMonitor is not None:
self.sessionMonitor.stop()
if isinstance(sys.stdout, RedirectedOutput):
sys.stdout.summary()
self.__wx_app.ExitMainLoop()
return True
示例4: __init__
def __init__(self, parent, title, bitmap='edit',
direction=None, *args, **kwargs):
self._buttonTypes = kwargs.get('buttonTypes', wx.OK | wx.CANCEL)
super(Dialog, self).__init__(parent, -1, title,
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX)
self.SetIcon(wx.ArtProvider_GetIcon(bitmap, wx.ART_FRAME_ICON,
(16, 16)))
if operating_system.isWindows7_OrNewer():
# Without this the window has no taskbar icon on Windows, and the focus comes back to the main
# window instead of this one when returning to Task Coach through Alt+Tab. Which is probably not
# what we want.
import win32gui, win32con
exStyle = win32gui.GetWindowLong(self.GetHandle(), win32con.GWL_EXSTYLE)
win32gui.SetWindowLong(self.GetHandle(), win32con.GWL_EXSTYLE, exStyle|win32con.WS_EX_APPWINDOW)
self._panel = self.GetContentsPane()
self._panel.SetSizerType('vertical')
self._panel.SetSizerProps(expand=True, proportion=1)
self._direction = direction
self._interior = self.createInterior()
self._interior.SetSizerProps(expand=True, proportion=1)
self.fillInterior()
self._buttons = self.createButtons()
self._panel.Fit()
self.Fit()
self.CentreOnParent()
if not operating_system.isGTK():
wx.CallAfter(self.Raise)
wx.CallAfter(self._panel.SetFocus)
示例5: _SetSelection
def _SetSelection(self, start, end):
if operating_system.isGTK(): # pragma: no cover
# By exchanging the start and end parameters we make sure that the
# cursor is at the start of the field so that typing overwrites the
# current field instead of moving to the next field:
start, end = end, start
super(FixOverwriteSelectionMixin, self)._SetSelection(start, end)
示例6: __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
示例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: addBitmapToMenuItem
def addBitmapToMenuItem(self, menuItem):
if self.bitmap2 and self.kind == wx.ITEM_CHECK and not operating_system.isGTK():
bitmap1 = self.__getBitmap(self.bitmap)
bitmap2 = self.__getBitmap(self.bitmap2)
menuItem.SetBitmaps(bitmap1, bitmap2)
elif self.bitmap and self.kind == wx.ITEM_NORMAL:
menuItem.SetBitmap(self.__getBitmap(self.bitmap))
示例9: setDescription
def setDescription(self, newDescription):
page = self.editor._interior[0]
page._descriptionEntry.SetFocus()
page._descriptionEntry.SetValue(newDescription)
if operating_system.isGTK(): # pragma: no cover
page._descriptionSync.onAttributeEdited(DummyEvent())
else: # pragma: no cover
page._subjectEntry.SetFocus()
示例10: tearDown
def tearDown(self):
# TaskEditor uses CallAfter for setting the focus, make sure those
# calls are dealt with, otherwise they'll turn up in other tests
if operating_system.isGTK():
wx.Yield() # pragma: no cover
super(TaskEditorTestCase, self).tearDown()
self.taskFile.close()
self.taskFile.stop()
示例11: __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
示例12: 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
示例13: __should_create_page
def __should_create_page(self, page_name):
if page_name == 'iphone':
return self.settings.getboolean('feature', 'iphone')
elif page_name == 'os_darwin':
return operating_system.isMac()
elif page_name == 'os_linux':
return operating_system.isGTK()
else:
return True
示例14: checkXFCE4
def checkXFCE4(self):
if operating_system.isGTK():
mon = application.Application().sessionMonitor
if mon is not None and \
self.settings.getboolean('feature', 'usesm2') and \
self.settings.getboolean('feature', 'showsmwarning') and \
mon.vendor == 'xfce4-session':
dlg = XFCE4WarningDialog(self, self.settings)
dlg.Show()
示例15: _setLocale
def _setLocale(self, language):
''' Try to set the locale, trying possibly multiple localeStrings. '''
if not operating_system.isGTK():
locale.setlocale(locale.LC_ALL, '')
# Set the wxPython locale:
for localeString in self._localeStrings(language):
languageInfo = wx.Locale.FindLanguageInfo(localeString)
if languageInfo:
self.__locale = wx.Locale(languageInfo.Language) # pylint: disable=W0201
# Add the wxWidgets message catalog. This is really only for
# py2exe'ified versions, but it doesn't seem to hurt on other
# platforms...
localeDir = os.path.join(wx.StandardPaths_Get().GetResourcesDir(), 'locale')
self.__locale.AddCatalogLookupPathPrefix(localeDir)
self.__locale.AddCatalog('wxstd')
break
if operating_system.isGTK():
locale.setlocale(locale.LC_ALL, '')
self._fixBrokenLocales()