示例#1
0
文件: TeamChooser.py 项目: Pesa/forse
 def __init__(self, parent=None):
     QDialog.__init__(self, parent)
     self.setupUi(self)
     self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
     handlers = {('init', 'names'): self._teamsInit,
                 ('update', 'names'): self._teamsUpdate}
     OTPApplication.registerMsgHandlers(handlers)
示例#2
0
 def __init__(self):
     QAbstractTableModel.__init__(self)
     self.__data = {}
     self.__intermediate = None
     self.__lap = None
     handlers = {('init', 'chrono'): self._chronoInit,
                 ('update', 'chrono'): self._chronoUpdate}
     OTPApplication.registerMsgHandlers(handlers)
示例#3
0
文件: WeatherView.py 项目: Pesa/forse
 def __init__(self, parent=None):
     TrackView.__init__(self, parent)
     self.setScene(QGraphicsScene())
     self._track = None
     handlers = {('init', 'sectors'): self._initTrack,
                 ('init', 'weather'): self._setWeather,
                 ('update', 'weather'): self._setWeather}
     OTPApplication.registerMsgHandlers(handlers)
示例#4
0
文件: SpeedModel.py 项目: Pesa/forse
 def __init__(self, carId):
     QAbstractTableModel.__init__(self)
     self.__id = carId
     self.__best = {}
     self.__last = {}
     handlers = {('init', 'best_speed'): self._newBestSpeed,
                 ('init', 'chrono'): self._newChrono}
     OTPApplication.registerMsgHandlers(handlers)
示例#5
0
 def __init__(self):
     QAbstractTableModel.__init__(self)
     self.__arrowDown = QIcon(":/icons/arrow-down.png")
     self.__arrowUp = QIcon(":/icons/arrow-up.png")
     self.__positions = {}
     handlers = {('init', 'standings'): self._standingsInit,
                 ('update', 'standings'): self._standingsUpdate}
     OTPApplication.registerMsgHandlers(handlers)
示例#6
0
文件: TimeModel.py 项目: Pesa/forse
 def __init__(self, carId):
     QAbstractTableModel.__init__(self)
     self.__id = carId
     self.__best = {}
     self.__last = {}
     self.__numInterm = 0
     handlers = {('init', 'best_lap'): self._newBestLap,
                 ('init', 'best_time'): self._newBestTime,
                 ('init', 'chrono'): self._newChrono,
                 ('init', 'last_lap'): self._newLastLap}
     OTPApplication.registerMsgHandlers(handlers)
示例#7
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setupUi(self)
     self.__nodesList = []
     self.__nodesModel = QStringListModel(self)
     self.nodesView.setModel(self.__nodesModel)
     OTPApplication.instance().lastWindowClosed.connect(self._quit)
     BootstrapServer.nodeDown.connect(self._nodeDown)
     BootstrapServer.nodeUp.connect(self._nodeUp)
     BootstrapServer.ready.connect(lambda: self.actionBootstrap.setEnabled(True))
     BootstrapServer.notReady.connect(lambda: self.actionBootstrap.setEnabled(False))
     QTimer.singleShot(0, self._startup)
示例#8
0
 def __init__(self, carId, state, pitCount, config):
     QWidget.__init__(self)
     self.setupUi(self)
     self.__config = config
     self.__fuel = None
     self.__id = carId
     self._setCarState(carId, state)
     self.psCountLabel.setText(str(pitCount))
     self.speedView.setModel(SpeedModel(self.__id))
     self.timeView.setModel(TimeModel(self.__id))
     handlers = {('init', 'car_state'): self._setCarState,
                 ('init', 'consumption'): self._setConsumption,
                 ('init', 'max_fuel'): self._setMaxFuel,
                 ('init', 'pitstop'): self._newPitstop}
     OTPApplication.registerMsgHandlers(handlers)
示例#9
0
文件: RaceView.py 项目: Pesa/forse
 def __init__(self, parent=None):
     TrackView.__init__(self, parent)
     scene = QGraphicsScene()
     scene.setItemIndexMethod(QGraphicsScene.NoIndex)
     self.setScene(scene)
     self._cars = {}
     self._track = None
     self._timer = QTimer(self)
     self._timer.setInterval(40)
     self._timer.timeout.connect(self.scene().advance)
     handlers = {('init', 'cars_pos'): self._initCars,
                 ('init', 'sectors'): self._initTrack,
                 ('init', 'race_state'): self._setRaceState,
                 ('update', 'cars_pos'): self._moveCars}
     OTPApplication.registerMsgHandlers(handlers)
示例#10
0
 def __init__(self):
     QAbstractTableModel.__init__(self)
     self.__changes = {}
     self.__weather = {}
     self.__sun = QIcon(":/icons/sun.png")
     self.__lightRain = QIcon(":/icons/light-rain.png")
     self.__rain = QIcon(":/icons/rain.png")
     self.__heavyRain = QIcon(":/icons/heavy-rain.png")
     self.__icons = [self.__sun]
     self.__icons[1:3] = [self.__lightRain] * 3
     self.__icons[4:7] = [self.__rain] * 4
     self.__icons[8:10] = [self.__heavyRain] * 3
     handlers = {('init', 'weather'): self._setWeather,
                 ('update', 'weather'): self._setWeather}
     OTPApplication.registerMsgHandlers(handlers)
示例#11
0
文件: Remote.py 项目: Pesa/forse
 def __call__(self, callback, *args):
     """
     Performs the actual remote call. The callable object C{callback} is
     invoked as soon as a reply has been received from the remote side.
     """
     d = OTPApplication.rpc(self.__mod, self.__fun, *args)
     if callback is not None:
         d.addBoth(lambda x: callback(_RPCReply(x)))
示例#12
0
 def _quit(self):
     BootstrapServer.shutdown(lambda _: OTPApplication.quit(), Atom("true"))
示例#13
0
 def _startup(self):
     if BootstrapServer.start():
         self._setGuiNode()
     else:
         QMessageBox.critical(self, "Fatal error", "Failed to start an instance of bootstrap_server.")
         OTPApplication.quit()
示例#14
0
文件: PilotInfo.py 项目: Pesa/forse
 def init(cls, refreshFunc):
     cls._refresh = refreshFunc
     handlers = {('init', 'cars_state'): cls._handleCarsState,
                 ('init', 'names'): cls._handleNames}
     OTPApplication.registerMsgHandlers(handlers)
示例#15
0
文件: Main.py 项目: Pesa/forse
# Copyright (c) 2010  Davide Pesavento <*****@*****.**>
#
# This file is part of FORSE.
#
# FORSE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FORSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FORSE.  If not, see <http://www.gnu.org/licenses/>.
#
###########################################################################

import sys
from ControlPanelWindow import ControlPanelWindow
from OTPApplication import OTPApplication


if __name__ == "__main__":
    app = OTPApplication("control_panel")
    app.setQuitOnLastWindowClosed(False)
    mainwin = ControlPanelWindow()
    mainwin.show()
    sys.exit(app.exec_())
示例#16
0
 def _setGuiNode(self):
     BootstrapServer.setGuiNode(self._setGuiNodeDone, OTPApplication.nodeName())
示例#17
0
文件: Main.py 项目: Pesa/forse
#
# Copyright (c) 2010  Davide Pesavento <*****@*****.**>
#
# This file is part of FORSE.
#
# FORSE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# FORSE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with FORSE.  If not, see <http://www.gnu.org/licenses/>.
#
###########################################################################

import sys
from NodeConfig import NodeConfig
from OTPApplication import OTPApplication


if __name__ == "__main__":
    app = OTPApplication("node_configurator")
    dialog = NodeConfig()
    dialog.show()
    sys.exit(app.exec_())
示例#18
0
文件: Subscriber.py 项目: Pesa/forse
 def __init__(self, appName):
     OTPApplication.__init__(self, appName)
     self.__opts = None