本文整理汇总了Python中Settings.Settings.getTzIndex方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.getTzIndex方法的具体用法?Python Settings.getTzIndex怎么用?Python Settings.getTzIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings.Settings
的用法示例。
在下文中一共展示了Settings.getTzIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from Settings import Settings [as 别名]
# 或者: from Settings.Settings import getTzIndex [as 别名]
class MainWindow(QMainWindow):
#
l = logging.getLogger('MainWindow')
# timeZones = [ ('UTC-12', -12), ('UTC-11', -11), ('UTC', 0), ('UTC+1', 1), ('UTC+2', 2)]
def __init__(self, app):
QMainWindow.__init__(self, None)
self.l.debug('Initializing MainWindow ...')
self.theSun = SunSimulator()
self.timeZones = []
for x in QTimeZone.availableTimeZoneIds():
tz = QTimeZone(x)
self.timeZones.append(tz)
#print(" {} {} {}".format(str(tz.id()), tz.comment(), tz.hasDaylightTime()))
#self.revLookup = {}
#idx = 0
#for d in self.timeZones:
# self.revLookup[d[1]] = idx
# idx += 1
self.setWindowTitle('Shadow')
# app.setWindowIcon(QIcon(':/icons/mynpad.png'))
#
# if os.name == 'nt':
# # On Windows, make sure to use a unique Application User Model Id, otherwise
# # Windows shows the default python icon in the taskbar
# # see http://stackoverflow.com/questions/1551605/how-to-set-applications-taskbar-icon-in-windows-7
# myappid = 'afester.mynpad'
# import ctypes; ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
self.theApplication = app
app.aboutToQuit.connect(self.saveState)
# read the local configuration file
iniPath = 'shadow.ini'
if not os.path.exists(iniPath):
iniPath = os.path.join(expanduser("~"), iniPath)
self.settings = Settings(iniPath)
self.settings.load()
# Set up the menu bar
menuBar = QMenuBar(self)
exitAction = QAction("Exit", self, triggered=self.theApplication.exit)
fileMenu = menuBar.addMenu("&File")
fileMenu.addAction(exitAction)
aboutAction = QAction("About ...", self, triggered = self.handleAbout)
helpMenu = menuBar.addMenu("&Help")
helpMenu.addAction(aboutAction)
self.setMenuBar(menuBar)
self.centralWidget = QWidget()
self.left = DataWidget(self.centralWidget)
self.right = ShadowWidget(self.centralWidget)
# Create time zone selector
self.left.ui.timeZoneComboBox.clear()
for tz in self.timeZones:
# TODO: Hack (?)
displayId = tz.id().data().decode(encoding="UTF-8")
if not displayId.startswith('UTC'):
utcOffset = tz.displayName(QTimeZone.GenericTime, QTimeZone.OffsetName)
#self.left.ui.timeZoneComboBox.addItem("({}) {} - {}".format(utcOffset, displayId, tz.comment()))
self.left.ui.timeZoneComboBox.addItem("({}) {}".format(utcOffset, displayId))
self.left.ui.timeZoneComboBox.setCurrentIndex(self.settings.getTzIndex())
self.left.ui.timeZoneComboBox.currentIndexChanged.connect(self.setTimeZone)
self.left.ui.dateEdit.dateChanged.connect(self.updateDate)
self.left.ui.timeEdit.timeChanged.connect(self.updateTime)
self.left.ui.timeSlider.valueChanged.connect(self.slideTime)
layout = QHBoxLayout()
self.centralWidget.setLayout(layout)
layout.addWidget(self.left)
layout.addWidget(self.right)
layout.setStretch(0, 0);
layout.setStretch(1, 1);
self.setCentralWidget(self.centralWidget)
# Reset main window size and position
pos = self.settings.getMainWindowPos()
self.move(pos.x(), pos.y())
size = self.settings.getMainWindowSize()
self.resize(size)
# sample values
self.left.ui.treeHeightLineEdit.setValue(10)
self.left.ui.latitudeLineEdit.setValue(48.1)
self.left.ui.LongitudeLineEdit.setValue(11.6)
self.left.ui.dateEdit.setDate(QDate(2015, 9, 11))
self.left.ui.timeEdit.setTime(QTime(8, 0))
#self.left.ui.latitudeLineEdit.setValue(50)
#self.left.ui.LongitudeLineEdit.setValue(10)
#.........这里部分代码省略.........