本文整理汇总了Python中bus.Bus.locateBus方法的典型用法代码示例。如果您正苦于以下问题:Python Bus.locateBus方法的具体用法?Python Bus.locateBus怎么用?Python Bus.locateBus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bus.Bus
的用法示例。
在下文中一共展示了Bus.locateBus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Window
# 需要导入模块: from bus import Bus [as 别名]
# 或者: from bus.Bus import locateBus [as 别名]
#.........这里部分代码省略.........
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:
self.settingwindow.show()
self.settingwindow.setFocus()
cb.setCurrentIndex(0)
self.changeShape(0)
else:
#self.bus=Bus(self.nametoid[self.busname],self.offset,self.backsb.value(),self.forwardsb.value())
#self.showMessage("Monitoring "+self.busname+".\n Alert near "+self.bus.offsetToName(self.bus.busoffset))
#if self.busname in self.nametoid:
stopnamelist=[x[0] for x in self.bus.waypointlist]
self.stopcb.setCurrentIndex(stopnamelist.index(self.bus.offsetToName(self.bus.busoffset)))
if len(self.bus.shape)!=0:
self.bus.locateBus()
self.mouse=None
self.timer=QtCore.QTimer()
self.timer.timeout.connect(self.doWork)
self.timer.start(8000)
def showMessage(self,message):
icon = QtGui.QSystemTrayIcon.MessageIcon()
#icon=QtGui.QSystemTrayIcon.Information
self.trayIcon.showMessage(
u'bus coming',message, icon,2000)
def mousePressEvent(self, event):
self.mouse=event.pos()
self.update()
def paintEvent(self,event):
qp=QtGui.QPainter()
qp.begin(self)
self.drawDetails(event,qp)
qp.end()
def drawDetails(self,event,qp):
if len(self.bus.shape)==0:
return
size=self.size()
w=size.width()
h=size.height()
wid=min(h,w/self.bus.xfactor)
margine=int(wid*0.05)
if self.mouse!=None:
t=self.mouse.toTuple()
qp.setPen(QtGui.QColor(168,34,3))
qp.setFont(QtGui.QFont('Decorative', 10))