Example #1
0
    def __init__(self, parent=None):
        QtWidgets.QListWidget.__init__(self, parent)
        self.setAlternatingRowColors(True)

        self.nm = NetworkManager()

        self.bus = dbus.SystemBus()
        nm_bus = self.bus.get_object(NM_BUS_NAME, NM_OBJECT_PATH)

        nm_interface = dbus.Interface(nm_bus, NM_INTERFACE)
        nm_interface.connect_to_signal(
            "DeviceAdded",
            lambda *args: self.showMessage("A new device added.", True))
        nm_interface.connect_to_signal("DeviceAdded", self.fillConnections)
        nm_interface.connect_to_signal(
            "DeviceRemoved",
            lambda *args: self.showMessage("A device removed.", True))
        nm_interface.connect_to_signal("DeviceRemoved", self.fillConnections)
        nm_interface.connect_to_signal("PropertiesChanged",
                                       lambda *args: self.stateChanged.emit())

        nm_settings_bus = self.bus.get_object(NM_BUS_NAME,
                                              NM_SETTINGS_OBJECT_PATH)
        nm_settings = dbus.Interface(nm_settings_bus, NM_SETTINGS)
        nm_settings.connect_to_signal(
            "NewConnection",
            lambda *args: self.showMessage("A new connection added.", True))
        nm_settings.connect_to_signal("NewConnection", self.fillConnections)

        self.timer = QTimer()
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(self.hideMessage)

        self.msgbox = None
        self.fillConnections()
Example #2
0
def main():

    # create the managers
    eMngr = EventManager()
    gMngr = GraphicManager(eMngr)
    iMngr = InputManager(eMngr, gMngr)
    uMngr = UpdateManager(eMngr)
    sMngr = SoundManager(eMngr)
    nMngr = NetworkManager(eMngr)

    print "starting game"
    # create file with input
    playFile = open(sys.argv[1], 'r')
    # start the managers
    eMngr.start()
    gMngr.start()
    iMngr.start()
    uMngr.start()
    sMngr.start()
    nMngr.start()

    # create game and start it
    # FIXME playfile should be passed to the updateManager
    game = Game(iMngr, uMngr, gMngr, sMngr, nMngr, playFile)
    game.run()

    # close the managers
    eMngr.stop()
    uMngr.stop()
    iMngr.stop()
    gMngr.stop()
    sMngr.stop()
    nMngr.stop()
 def __init__(self, maxy, maxx, install_config, title, intro, dest, setup_network=False):
     self.install_config = install_config
     self.maxy = maxy
     self.maxx = maxx
     self.title = title
     self.intro = intro
     self.netmgr = None
     self.dest = dest
     self.setup_network = setup_network
     if self.setup_network:
         self.netmgr = NetworkManager(install_config)