本文整理匯總了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))