本文整理汇总了Python中bus.Bus.getRouteIDs方法的典型用法代码示例。如果您正苦于以下问题:Python Bus.getRouteIDs方法的具体用法?Python Bus.getRouteIDs怎么用?Python Bus.getRouteIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bus.Bus
的用法示例。
在下文中一共展示了Bus.getRouteIDs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from bus import Bus [as 别名]
# 或者: from bus.Bus import getRouteIDs [as 别名]
def __init__(self):
self.bus=None
self.count=0
super(Window, self).__init__()
#need to catch timeout exceptions etc...
self.settings = QtCore.QSettings('busSettings.ini', QtCore.QSettings.IniFormat)
self.settings.setFallbacksEnabled(False) # File only, no fallback to registry or or.
# Initial window size/pos last saved if available
#self.resize(400, 300)
#self.setGeometry(200, 200,500*self.bus.xfactor,500)
self.resize(self.settings.value('size', QtCore.QSize(350, 500)))
self.move(self.settings.value('pos', QtCore.QPoint(200, 200)))
self.offset=int(self.settings.value('offset',89))
self.busname=(self.settings.value('bus',None))
self.setWindowTitle(u"busLocator map")
self.show()
#-------------------basic menu item------------------
self.settingAction = QtGui.QAction(u"setting", self,
triggered=self.showSettingWindow)
self.minimizeAction = QtGui.QAction(u"hide", self,
triggered=self.hide)
self.restoreAction = QtGui.QAction(u"show", self,
triggered=self.showNormal)
self.quitAction = QtGui.QAction(u"exit", self,
triggered=self.quitApplication)
#add menu
self.trayIconMenu = QtGui.QMenu(self)
self.trayIconMenu.addAction(self.restoreAction)
self.trayIconMenu.addAction(self.minimizeAction)
self.trayIconMenu.addAction(self.settingAction)
self.trayIconMenu.addAction(self.quitAction)
#self.trayIconMenu.clear()
#self.trayIconMenu.addAction(self.quitAction)
self.trayIcon = QtGui.QSystemTrayIcon(self)
self.trayIcon.setContextMenu(self.trayIconMenu)
#-------------------basic menu end------------------
#-------------------icon------------------
self.icon=QtGui.QIcon(":/images/bus.ico")
self.trayIcon.setIcon(self.icon)
#tooltip do not work on both ubuntu and win
#self.trayIcon.setToolTip("tooltip")
self.trayIcon.show()
self.trayIcon.activated.connect(
self.iconActivated)
self.nameid=Bus.getRouteIDs()
#self.nameid=Bus.getActiveRoute()
self.names=[x[0] for x in self.nameid]
self.nametoid=dict(self.nameid)
#print self.busname
#print self.nameid
self.backsb=QtGui.QSpinBox()
self.backsb.setRange(0,25)
self.backsb.valueChanged[int].connect(self.backChange)
self.backsb.setValue(int(self.settings.value('backward',10)))
self.forwardsb=QtGui.QSpinBox()
self.forwardsb.setRange(0,25)
self.forwardsb.valueChanged[int].connect(self.forwardChange)
self.forwardsb.setValue(int(self.settings.value('forward',10)))
self.sbGroup=QtGui.QWidget()
self.sblayout=QtGui.QHBoxLayout()
self.sblayout.setSpacing(0)
self.sblayout.addWidget(QtGui.QLabel("backward:"))
self.sblayout.addWidget(self.backsb)
self.sblayout.addWidget(QtGui.QLabel("forward:"))
self.sblayout.addWidget(self.forwardsb)
self.sbGroup.setLayout(self.sblayout)
self.settingwindow=QtGui.QWidget()
cb=QtGui.QComboBox()
self.stopcb=QtGui.QComboBox()
self.stopcb.currentIndexChanged.connect(self.changeOffset)
for n in self.names:
cb.addItem(n)
cb.currentIndexChanged.connect(self.changeShape)
if self.busname in self.nametoid:
ind=self.names.index(self.busname)
cb.setCurrentIndex(ind)
self.changeShape(ind)
toprow=QtGui.QGroupBox("Please select route")
toplayout=QtGui.QFormLayout()
toplayout.addRow(QtGui.QLabel("Route:"),cb)
toprow.setLayout(toplayout)
botrow=QtGui.QGroupBox("Route detail:")
botlayout=QtGui.QFormLayout()
botlayout.addRow(QtGui.QLabel("Stop to be alert:"),self.stopcb)
botlayout.addRow(QtGui.QLabel("Fine adjustment:"),self.sbGroup)
#botlayout.addRow([QtGui.QLabel("backward:"),self.backsb,QtGui.QLabel("forward:"),self.forwardsb])
botrow.setLayout(botlayout)
slayout=QtGui.QVBoxLayout()
slayout.addWidget(toprow)
slayout.addWidget(botrow)
self.settingwindow.setLayout(slayout)
self.settingwindow.setWindowTitle(u"busLocator Setting")
self.settingwindow.resize(self.settings.value('setsize',
QtCore.QSize(288,134)))
self.settingwindow.move(self.settings.value('setpos', QtCore.QPoint(566, 202)))
if self.busname not in self.nametoid:
#.........这里部分代码省略.........