Пример #1
0
 def __init__(self):
     Component.__init__(self)
     self._commService = naali.communicationsservice
     self._voiceSession = None
     self._indicators = {}
     self._commService.connect("InWorldVoiceAvailable()",
                               self.onNewVoiceSession)
Пример #2
0
    def __init__(self):
        Component.__init__(self)
        self.worldstream = None
        #self.worldstream = r.getServerConnection()
        self.queue = Queue.Queue()
        self.window = EstateManagementWindow(self, self.queue)
        self.uievents = UIEventManagement(self.window) 
        self.rexlogic = r.getRexLogic()
        self.appdatafolder = ""
        try:
            self.appdatafolder = r.getApplicationDataDirectory()
        except:
            r.logInfo("Unexpected error:", sys.exc_info()[0])

        self.rexlogic.connect("OnIncomingEstateOwnerMessage(QVariantList)", self.onEstateOwnerMessage)
        self.ents = []
        self.managers = {}
        self.banned = {}
        self.accesslist = {}
        self.publicestate = True
        self.nameToUuidMapCache = {}
        self.savedusers = {}
        
        #self.estatesettings = EstateSettings(self.worldstream, self)
        self.estatesettings = None
Пример #3
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader() 
        uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        #group = QGroupBox()
        #box = QVBoxLayout(group)
        #button = QPushButton(group)
        #box.addWidget(button)
        #group.show()
        #self.canvas.AddWidget(group)

        lineedit = QLineEdit()
        self.widget = lineedit
        #lineedit.show()
        #uiprops = UiWidgetProperties("PythonQt Test")
        #uism.AddWidgetToScene(lineedit) #uiprops) #self.canvas.AddWidget(lineedit)

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty()
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        lineedit.connect('textChanged(QString)', self.changed)

        r.logInfo("TestGui inited.")
Пример #4
0
 def __init__(self):
     log("RaspuinoDart::__init__")
     Component.__init__(self)
     RaspuinoDartDB().register(self)
     RaspuinoDartGame().register(self)
     RaspuinoDartServer().register(self)
     RaspuinoDartBoard().register(self)
Пример #5
0
    def __init__(self):
        Component.__init__(self)
        """
        This dictionary has the keyboard commands, well the
        event ids for different keys that are currently enabled
        on the python side.
        
        (KEY_ID, MOD_ID): methodToCall()
        """
        self.keymap = {
            (OIS_KEY_PERIOD, OIS_KEY_ALT):
            self.run_commandpy,
            #(OIS_KEY_M, OIS_KEY_ALT): self.toggle_editgui,
            (OIS_KEY_BACKSPACE, OIS_KEY_ALT):
            self.restart_modulemanager
        }
        """
        These are the input events as they have already been translated within Naali internals.
        For example both 'w' and 'uparrow' keypresses cause a MoveForwardPressed input event.
        """
        self.inputmap = {
            r.PyRestart: self.restart_modulemanager,
            r.PyRunCommand: self.run_commandpy
            #r.MoveForwardPressed: self.overrideForwardWalking #overrides the moveforward event
        }

        #XXX a temp hack to have restart work in login screen / ether too
        uiview = r.getUiView()
        uiview.connect("PythonRestartRequest()", self.restart_modulemanager)
Пример #6
0
 def __init__(self, test=False):
     Component.__init__(self)
     if test:
         self.file = NamedTemporaryFile()
         self.filename = self.file.name
     else:
         self.filename = join(LOG_ROOT, 'darts.db')
Пример #7
0
    def __init__(self):
        if self.debug is None:
            self.debug = conf.config["debug"]
        set_proc_status("Init")
        Component.__init__(self)

        if self.debug:
            Debugger(
                logger=logger.getChild("events"),
                IgnoreChannels=("discovery", "peer", "log_watch"),
                IgnoreEvents=(
                    "registered",
                    "unregistered",
                    "prepare_unregister",
                    "prepare_unregister_complete",
                    "managers_check",
                    "resource_health_check",
                    "target_check_luns",
                    "dkv_update",
                ),
            ).register(self)

        self.dkv = DkvManager().register(self)
        # self.dkv.dkv.wait_for_connected(timeout=30)
        self.fire(DkvWaitForConnected(timeout=30))

        Inner().register(self)
Пример #8
0
 def __init__(self, xmpp_client, hostname, port):
     Component.__init__(self)
     self.client = xmpp_client
     
     self.tcp = TCPClient()
     self += self.tcp
     self.push(Connect(hostname, port))
Пример #9
0
    def __init__(self):
        log("RaspuinoDartDB::__init__")
        Component.__init__(self)
        self.dbname = "RaspuinoDart.db"
        self.conn = sqlite3.connect(self.dbname)

        ini_players = [
            ("Sascha", "20170210-000000", ""),
            ("Heike", "20170210-000000", ""),
            ("Michi", "20170210-000000", ""),
            ("Jochen", "20170210-000000", ""),
        ]

        # self.matchData = {
        #   0: {"type": 0, "datetime": datetime.now().strftime("%Y%m%d-%H%M%S"), "players": [0, 2, 3], "history": []},
        #   1: {"type": 0, "datetime": datetime.now().strftime("%Y%m%d-%H%M%S"), "players": [3, 0, 2], "history": []}
        # }

        self.conn.execute(
            "CREATE TABLE IF NOT EXISTS players(name TEXT, joined TEXT, matches TEXT)"
        )

        self.conn.executemany('INSERT INTO players VALUES (?,?,?)',
                              ini_players)
        # self.conn.execute("INSERT INTO players(name, joined, matches) VALUES ('Sascha', '20170210-000000', '0, 1')")
        for row in self.conn.execute("SELECT * FROM players"):
            log("{}".format(row))
        self.conn.close()
Пример #10
0
    def __init__(self):
        Component.__init__(self)
        """
        This dictionary has the keyboard commands, well the
        event ids for different keys that are currently enabled
        on the python side.
        
        (KEY_ID, MOD_ID): methodToCall()
        """
        self.keymap = {
            (OIS_KEY_PERIOD, OIS_KEY_ALT): self.run_commandpy,
            #(OIS_KEY_M, OIS_KEY_ALT): self.toggle_editgui,
            (OIS_KEY_BACKSPACE, OIS_KEY_ALT): self.restart_modulemanager
        }
        
        """
        These are the input events as they have already been translated within Naali internals.
        For example both 'w' and 'uparrow' keypresses cause a MoveForwardPressed input event.
        """
        self.inputmap = {
            r.PyRestart: self.restart_modulemanager,
            r.PyRunCommand: self.run_commandpy
            #r.MoveForwardPressed: self.overrideForwardWalking #overrides the moveforward event
        }

        #XXX a temp hack to have restart work in login screen / ether too
        uiview = r.getUiView()
        uiview.connect("PythonRestartRequest()", self.restart_modulemanager)
Пример #11
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader() 
        uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        #group = QGroupBox()
        #box = QVBoxLayout(group)
        #button = QPushButton(group)
        #box.addWidget(button)
        #group.show()
        #self.canvas.AddWidget(group)

        lineedit = QLineEdit()
        self.widget = lineedit
        #lineedit.show()
        #uiprops = UiWidgetProperties("PythonQt Test")
        #uism.AddWidgetToScene(lineedit) #uiprops) #self.canvas.AddWidget(lineedit)

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty()
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        lineedit.connect('textChanged(QString)', self.changed)

        r.logInfo("TestGui inited.")
Пример #12
0
    def __init__(self):
        self.sels = []  
        self.selmasses = {}
        Component.__init__(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()
        self.usingManipulator = False
        self.useLocalTransform = False
        #self.cpp_python_handler = None
        self.left_button_down = False
        self.keypressed = False
        self.editing = False
                
        self.editingKeyTrigger = (Qt.Key_M, Qt.ShiftModifier)
        self.shortcuts = {
            self.editingKeyTrigger : self.toggleEditingKeyTrigger,
            (Qt.Key_R, Qt.NoModifier) : self.rotateObject,
            (Qt.Key_S, Qt.NoModifier) : self.scaleObject,
            (Qt.Key_G, Qt.NoModifier) : self.translateObject,
            (Qt.Key_Tab, Qt.NoModifier) : self.cycleManipulator,
            (Qt.Key_Z, Qt.ControlModifier) : self.undo,
            (Qt.Key_Delete, Qt.NoModifier) : self.deleteObject,
            (Qt.Key_L, Qt.AltModifier) : self.linkObjects,
            (Qt.Key_L, Qt.ControlModifier|Qt.ShiftModifier) : self.unlinkObjects,
        }

        # Connect to key pressed signal from input context
        self.edit_inputcontext = naali.createInputContext("object-edit", 100)
        self.edit_inputcontext.SetTakeMouseEventsOverQt(True)
        #print "connecting to",self.edit_inputcontext
        self.edit_inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed)

        # Connect to mouse events
        self.edit_inputcontext.connect('MouseScroll(MouseEvent*)', self.on_mousescroll)
        self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)', self.on_mouseleftpressed)
        self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)', self.on_mouseleftreleased)
        self.edit_inputcontext.connect('MouseMove(MouseEvent*)', self.on_mousemove)
        
        self.resetManipulators()
        
        self.selection_rect = QRect()
        self.selection_rect_startpos = None
        
        r.c = self #this is for using objectedit from command.py

        self.selection_box_entity = None
        self.selection_box = None
        self.selection_box_inited = False
        
        self.menuToggleAction = None
        mainWindow = naali.ui.MainWindow()
        print mainWindow
        if mainWindow:
            menuBar = mainWindow.menuBar()
            self.menuToggleAction = menuBar.addAction("Manipulation Toggle")
            self.menuToggleAction.connect("triggered()", self.toggleEditingKeyTrigger)
        self.toggleEditing(False)
        
        """
Пример #13
0
 def __init__(self):
     Component.__init__(self)
     self.connectState = {
         'state': 'null', 
         'players': [], 
         'ranking': []
     }
     self.connectSettings = {}
     self.knownSockets = []  
     self.random_id = random()
Пример #14
0
 def __init__(self, one_game):
     Component.__init__(self)
     
     VersionManager().register(self)
     DartGame(one_game).register(self)
     DartsWebServer().register(self)
     Logger().register(self)
     DetailedLogger().register(self)
     
     self.inputsys = None
     self.soundsys = type(None)
     self.logsys = None
Пример #15
0
    def __init__(self):
        self.sels = []
        Component.__init__(self)
        self.window = window.ObjectEditWindow(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()

        self.mouse_events = {
            #r.LeftMouseClickPressed: self.LeftMousePressed,
            r.InWorldClick: self.LeftMousePressed,
            r.LeftMouseClickReleased: self.LeftMouseReleased,
            r.RightMouseClickPressed: self.RightMousePressed,
            r.RightMouseClickReleased: self.RightMouseReleased
        }

        self.shortcuts = {
            #r.PyObjectEditDeselect: self.deselect,
            r.PyObjectEditToggleMove:
            self.window.manipulator_move,  #"ALT+M", #move
            r.PyObjectEditToggleScale:
            self.window.manipulator_scale,  #"ALT+S" #, #scale
            r.Delete:
            self.deleteObject,
            r.Undo:
            self.undo,
            r.PyDuplicateDrag:
            self.duplicateStart,
            r.ObjectLink:
            self.linkObjects,
            r.ObjectUnlink:
            self.unlinkObjects,
        }

        self.resetManipulators()

        loader = QUiLoader()
        selectionfile = QFile(self.SELECTIONRECT)
        self.selection_rect = loader.load(selectionfile)
        rectprops = r.createUiWidgetProperty(2)
        #~ print type(rectprops), dir(rectprops)
        #print rectprops.WidgetType
        #uiprops.widget_name_ = "Selection Rect"

        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        proxy = r.createUiProxyWidget(self.selection_rect, rectprops)
        uism = r.getUiSceneManager()
        uism.AddProxyWidget(proxy)
        proxy.setWindowFlags(0)  #changing it to Qt::Widget

        self.selection_rect.setGeometry(0, 0, 0, 0)
        self.selection_rect_startpos = None

        r.c = self  #this is for using objectedit from command.py
Пример #16
0
    def __init__(self):
        # instanciated from the c++ side, as modulemanager there
        #assert self.instance is None
        Component.__init__(self)
        ComponentRunner.instance = self  #is used as a singleton now

        self.mouseinfo = MouseInfo(0, 0, 0, 0)
        #m.start() #instead we tick() & flush() in update

        self.firstrun = True
        self.eventhandled = False
        r.restart = False
        self.start()
        r.manager = self
Пример #17
0
    def __init__(self):
        Component.__init__(self)

        PeerManager().register(self)
        Discovery().register(self)
        DeviceManager().register(self)
        FloatingIPManager().register(self)
        ResourceManager().register(self)
        TargetManager().register(self)
        # TODO Finish this
        # AutoSnapshotManager().register(self)
        # TODO Finish this
        # BackupManager().register(self)
        LogWatchManager().register(self)
Пример #18
0
    def __init__(self):
        # instanciated from the c++ side, as modulemanager there
        # assert self.instance is None
        Component.__init__(self)
        ComponentRunner.instance = self  # is used as a singleton now

        self.mouseinfo = MouseInfo(0, 0, 0, 0)
        # m.start() #instead we tick() & flush() in update

        self.firstrun = True
        self.eventhandled = False
        r.restart = False
        self.start()
        r.manager = self
Пример #19
0
 def __init__(self, short="", description="", players={}):
     log("RaspuinoDartMatch::__init__({}, {}, {})".format(
         type, description, players))
     Component.__init__(self)
     self.ongoing = True
     self.numberOfDarts = 3
     self.short = short
     self.description = description
     self.players = players
     self.history = [{"player": 0, "frame": 0}]
     self.nextup = {"player": 0, "frame": 0, "dart": 0}
     self.printRaspuinoDartMatch()
     self.applyRules()
     self.moveHistory()
Пример #20
0
    def __init__(self):
        Component.__init__(self)

        # Create the queue, for feeding events for ui
        self.queue = Queue.Queue()

        # A timer to periodically read input
        self.timer = PythonQt.QtCore.QTimer()
        PythonQt.QtCore.QObject.connect(self.timer,
                           PythonQt.QtCore.SIGNAL("timeout()"),
                           self.periodicCall)
        # self.timer.start(1000)        
        self.window = LCwindow(self, self.queue, self.endApplication)

        self.isrunning = 1

        self.uploadThread = None
        self.sceneActionThread = None

        self.xshift = 127
        self.yshift = 127
        self.zshift = 25
        self.xscale = 1
        self.yscale = 1
        self.zscale = 1
        self.dotScene = None
        self.dsManager = None
        self.worldstream = None
        self.flipZY = True
        #self.flipZY = False
        self.highlight = False
        self.uploader = None
        self.filename = ""
        self.scenedata = None

        self.regionName = None
        self.publishName = None

        self.sceneActions = None # sceneactions.SceneActions()
        globals()["glocalscene"] = self
        self.bLocalSceneLoaded = False

        #self.libMod = r.getLibraryModule()

        #self.libMod.connect("UploadSceneFile(QString, QVect)", self.onUploadSceneFile)
        pass
Пример #21
0
 def __init__(self):
     Component.__init__(self)
     #self.proxywidget = None
     self.container = None
     
     self.webview = None
     self.lineedit_address = None
     self.progress_bar = None
     self.progress_label = None
     self.button_back = None
     self.button_forward = None
     self.button_go = None
     self.button_refresh = None
     self.button_stop = None
     
     global instance
     instance = self
Пример #22
0
    def __init__(self):
        Component.__init__(self)

        # Create the queue, for feeding events for ui
        self.queue = Queue.Queue()

        # A timer to periodically read input
        self.timer = PythonQt.QtCore.QTimer()
        PythonQt.QtCore.QObject.connect(self.timer,
                                        PythonQt.QtCore.SIGNAL("timeout()"),
                                        self.periodicCall)
        # self.timer.start(1000)
        self.window = LCwindow(self, self.queue, self.endApplication)

        self.isrunning = 1

        self.uploadThread = None
        self.sceneActionThread = None

        self.xshift = 127
        self.yshift = 127
        self.zshift = 25
        self.xscale = 1
        self.yscale = 1
        self.zscale = 1
        self.dotScene = None
        self.dsManager = None
        self.worldstream = None
        self.flipZY = True
        #self.flipZY = False
        self.highlight = False
        self.uploader = None
        self.filename = ""
        self.scenedata = None

        self.regionName = None
        self.publishName = None

        self.sceneActions = None  # sceneactions.SceneActions()
        globals()["glocalscene"] = self
        self.bLocalSceneLoaded = False

        #self.libMod = r.getLibraryModule()

        #self.libMod.connect("UploadSceneFile(QString, QVect)", self.onUploadSceneFile)
        pass
Пример #23
0
    def __init__(self):
        self.sels = []  
        Component.__init__(self)
        self.window = window.ObjectEditWindow(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()
        
        self.mouse_events = {
            #r.LeftMouseClickPressed: self.LeftMousePressed,
            r.InWorldClick: self.LeftMousePressed,
            r.LeftMouseClickReleased: self.LeftMouseReleased,  
            r.RightMouseClickPressed: self.RightMousePressed,
            r.RightMouseClickReleased: self.RightMouseReleased
        }

        self.shortcuts = {
            #r.PyObjectEditDeselect: self.deselect,
            r.PyObjectEditToggleMove: self.window.manipulator_move,#"ALT+M", #move
            r.PyObjectEditToggleScale: self.window.manipulator_scale,#"ALT+S" #, #scale
            r.Delete: self.deleteObject,
            r.Undo: self.undo, 
            r.PyDuplicateDrag: self.duplicateStart, 
            r.ObjectLink: self.linkObjects,
            r.ObjectUnlink: self.unlinkObjects,
        }
        
        self.resetManipulators()
        
        loader = QUiLoader()
        selectionfile = QFile(self.SELECTIONRECT)
        self.selection_rect = loader.load(selectionfile)
        rectprops = r.createUiWidgetProperty(2)
        #~ print type(rectprops), dir(rectprops)
        #print rectprops.WidgetType
        #uiprops.widget_name_ = "Selection Rect"
        
        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        proxy = r.createUiProxyWidget(self.selection_rect, rectprops)
        uism = r.getUiSceneManager()
        uism.AddProxyWidget(proxy)
        proxy.setWindowFlags(0) #changing it to Qt::Widget
        
        self.selection_rect.setGeometry(0,0,0,0)
        self.selection_rect_startpos = None
        
        r.c = self #this is for using objectedit from command.py
Пример #24
0
    def __init__(self):
        Component.__init__(self)

        loader = QUiLoader()
        uism = r.getUiSceneManager()

        uifile = QFile(UIFILELOC)
        self.widget = loader.load(uifile)
        uism.SetDemoLoginWidget(self.widget)

        def make_worldlogin(w):
            def worldlogin():
                self.login(w)
            return worldlogin

        for w in self.WORLDS:
            but = getattr(self.widget, w.butname)
            but.connect('clicked()', make_worldlogin(w))       
Пример #25
0
    def __init__(self):
        Component.__init__(self)
        """
        This dictionary has the keyboard commands, well the
        event ids for different keys that are currently enabled
        on the python side. Now using qt input constants.
        
        (KEY_ID, MOD_ID): methodToCall()
        """

        self.inputmap = {
            (Qt.Key_Period, Qt.AltModifier): self.run_commandpy,
            (Qt.Key_F11, Qt.NoModifier): self.restart_modulemanager
            }
            #r.MoveForwardPressed: self.overrideForwardWalking #overrides the moveforward event

        inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed)
        #XXX a temp hack to have restart work in login screen / ether too
        uiview = r.getUiView()
        uiview.connect('PythonRestartRequest()', self.restart_modulemanager)
Пример #26
0
    def __init__(self):
        Component.__init__(self)
        """
        This dictionary has the keyboard commands, well the
        event ids for different keys that are currently enabled
        on the python side. Now using qt input constants.
        
        (KEY_ID, MOD_ID): methodToCall()
        """

        self.inputmap = {
            (Qt.Key_Period, Qt.AltModifier): self.run_commandpy,
            (Qt.Key_F11, Qt.NoModifier): self.restart_modulemanager
        }
        #r.MoveForwardPressed: self.overrideForwardWalking #overrides the moveforward event

        inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed)
        #XXX a temp hack to have restart work in login screen / ether too
        uiview = r.getUiView()
        uiview.connect('PythonRestartRequest()', self.restart_modulemanager)
Пример #27
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader()
        #uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        group = QGroupBox()
        box = QVBoxLayout(group)

        button1 = QPushButton("Button 1", group)
        box.addWidget(button1)

        button2 = QPushButton("Button 2", group)
        box.addWidget(button2)

        slider = QtGui.QSlider(PythonQt.QtCore.Qt.Horizontal)
        box.addWidget(slider)
        slider.connect('valueChanged(int)', self.changed)

        #group.show()

        lineedit = QtGui.QLineEdit()
        box.addWidget(lineedit)
        lineedit.connect('textChanged(QString)', self.changed)

        self.widget = group

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1)
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        r.logInfo("TestGui inited.")
Пример #28
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader()
        #uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        group = QGroupBox()
        box = QVBoxLayout(group)

        button1 = QPushButton("Button 1", group)
        box.addWidget(button1)

        button2 = QPushButton("Button 2", group)
        box.addWidget(button2)

        slider = QtGui.QSlider(PythonQt.QtCore.Qt.Horizontal)
        box.addWidget(slider)
        slider.connect('valueChanged(int)', self.changed)

        #group.show()

        lineedit = QtGui.QLineEdit()
        box.addWidget(lineedit)
        lineedit.connect('textChanged(QString)', self.changed)

        self.widget = group

        #naali proxywidget boilerplate
        GUINAME = "Python Webmodule Test"
        uism = naali.ui
        self.proxywidget = r.createUiProxyWidget(self.widget)
        self.proxywidget.setWindowTitle(GUINAME)
        if not uism.AddWidgetToScene(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."
        # TODO: Due to core UI API refactor AddWidgetToMenu doesn't exist anymore.
        #uism.AddWidgetToMenu(self.proxywidget, GUINAME, "Developer Tools")

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        r.logInfo("TestGui inited.")
Пример #29
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader()
        #uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        group = QGroupBox()
        box = QVBoxLayout(group)

        button1 = QPushButton("Button 1", group)
        box.addWidget(button1)

        button2 = QPushButton("Button 2", group)
        box.addWidget(button2)

        slider = QtGui.QSlider(PythonQt.QtCore.Qt.Horizontal)
        box.addWidget(slider)
        slider.connect('valueChanged(int)', self.changed)

        #group.show()

        lineedit = QtGui.QLineEdit()
        box.addWidget(lineedit)
        lineedit.connect('textChanged(QString)', self.changed)

        self.widget = group

        #naali proxywidget boilerplate
        GUINAME = "Python Webmodule Test"
        uism = naali.ui
        self.proxywidget = r.createUiProxyWidget(self.widget)
        self.proxywidget.setWindowTitle(GUINAME)
        if not uism.AddWidgetToScene(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."
        # TODO: Due to core UI API refactor AddWidgetToMenu doesn't exist anymore.
        #uism.AddWidgetToMenu(self.proxywidget, GUINAME, "Developer Tools")

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        r.logInfo("TestGui inited.")
Пример #30
0
    def __init__(self):
        Component.__init__(self)
        #loader = QUiLoader()
        #uism = r.getUiSceneManager() #self.canvas = r.createCanvas(EXTERNAL)

        group = QGroupBox()
        box = QVBoxLayout(group)

        button1 = QPushButton("Button 1", group)
        box.addWidget(button1)

        button2 = QPushButton("Button 2", group)
        box.addWidget(button2)

        slider = QtGui.QSlider(PythonQt.QtCore.Qt.Horizontal)
        box.addWidget(slider)
        slider.connect('valueChanged(int)', self.changed)

        #group.show()

        lineedit = QtGui.QLineEdit()
        box.addWidget(lineedit)
        lineedit.connect('textChanged(QString)', self.changed)

        self.widget = group

        uism = r.getUiSceneManager()
        uiprops = r.createUiWidgetProperty(1)
        uiprops.widget_name_ = "Test Widget"
        #uiprops.my_size_ = QSize(width, height)
        #self.proxywidget = uism.AddWidgetToScene(ui, uiprops)
        self.proxywidget = r.createUiProxyWidget(self.widget, uiprops)
        ##print widget, dir(widget)
        if not uism.AddProxyWidget(self.proxywidget):
            print "Adding the ProxyWidget to the bar failed."

        #self.canvas.Show()

        #QInputDialog.getText(None, "Mesh asset UUID", "Please give mesh asset UUID", QLineEdit.Normal, "")

        r.logInfo("TestGui inited.")
Пример #31
0
    def __init__(self, filename, defaults=None):
        Component.__init__(self)
        ConfigParser.__init__(self, defaults=defaults)

        self.filename = filename
Пример #32
0
 def __init__(self):
     Component.__init__(self)
     
     #XXX should done this only after connecting or something
     self.target = r.getEntity(idnum)
     print "MouseControl inited with target", self.target
Пример #33
0
 def __init__(self, test=False):
     Component.__init__(self)
     self.test = test
     self.file = None
Пример #34
0
    def __init__(self):
        Component.__init__(self)

        #XXX should done this only after connecting or something
        self.target = r.getEntity(idnum)
        print "MouseControl inited with target", self.target
Пример #35
0
 def __init__(self, uniquename=None, *args, **kwargs):
     ConfigurableMeta.__init__(self, uniquename)
     Component.__init__(self, *args, **kwargs)
Пример #36
0
 def __init__(self):
     log("RaspuinoDartMiniGame::__init__")
     Component.__init__(self)
Пример #37
0
    def __init__(self):
        self.sels = []  
        Component.__init__(self)
        self.window = window.ObjectEditWindow(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()
        self.usingManipulator = False
        self.useLocalTransform = False
        self.cpp_python_handler = None
        self.left_button_down = False
        self.keypressed = False

        self.shortcuts = {
            (Qt.Key_Z, Qt.ControlModifier) : self.undo,
            (Qt.Key_Delete, Qt.NoModifier) : self.deleteObject,
            (Qt.Key_L, Qt.AltModifier) : self.linkObjects,
            (Qt.Key_L, Qt.ControlModifier|Qt.ShiftModifier) : self.unlinkObjects,
        }

        # Connect to key pressed signal from input context
        self.edit_inputcontext = naali.createInputContext("object-edit", 100)
        self.edit_inputcontext.SetTakeMouseEventsOverQt(True)
        self.edit_inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed)

        # Connect to mouse events
        self.edit_inputcontext.connect('MouseScroll(MouseEvent*)', self.on_mousescroll)
        self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)', self.on_mouseleftpressed)
        self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)', self.on_mouseleftreleased)
        self.edit_inputcontext.connect('MouseMove(MouseEvent*)', self.on_mousemove)
        
        self.resetManipulators()
        
        loader = QUiLoader()
        selectionfile = QFile(self.SELECTIONRECT)
        self.selection_rect = loader.load(selectionfile)
        #rectprops = r.createUiWidgetProperty(2)
        #~ print type(rectprops), dir(rectprops)
        #print rectprops.WidgetType
        #uiprops.widget_name_ = "Selection Rect"
        
        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        proxy = r.createUiProxyWidget(self.selection_rect)
        uism = r.getUiSceneManager()
        uism.AddWidgetToScene(proxy)
        proxy.setWindowFlags(0) #changing it to Qt::Widget
        
        self.selection_rect.setGeometry(0,0,0,0)
        self.selection_rect_startpos = None
        
        r.c = self #this is for using objectedit from command.py
        
        # Get world building modules python handler
        self.cpp_python_handler = r.getQWorldBuildingHandler()
        if self.cpp_python_handler == None:
            r.logDebug("Could not aqquire world building service to object edit")
        else:
            # Connect signals
            self.cpp_python_handler.connect('ActivateEditing(bool)', self.on_activate_editing)
            self.cpp_python_handler.connect('ManipulationMode(int)', self.on_manupulation_mode_change)
            self.cpp_python_handler.connect('RemoveHightlight()', self.deselect_all)
            self.cpp_python_handler.connect('RotateValuesToNetwork(int, int, int)', self.changerot_cpp)
            self.cpp_python_handler.connect('ScaleValuesToNetwork(double, double, double)', self.changescale_cpp)
            self.cpp_python_handler.connect('PosValuesToNetwork(double, double, double)', self.changepos_cpp)
            self.cpp_python_handler.connect('CreateObject()', self.createObject)
            self.cpp_python_handler.connect('DuplicateObject()', self.duplicate)
            self.cpp_python_handler.connect('DeleteObject()', self.deleteObject)
            # Pass widgets
            self.cpp_python_handler.PassWidget("Mesh", self.window.mesh_widget)
            self.cpp_python_handler.PassWidget("Animation", self.window.animation_widget)
            self.cpp_python_handler.PassWidget("Sound", self.window.sound_widget)
            self.cpp_python_handler.PassWidget("Materials", self.window.materialTabFormWidget)
            # Check if build mode is active, required on python restarts
            self.on_activate_editing(self.cpp_python_handler.IsBuildingActive())
Пример #38
0
 def __init__(self):
     Component.__init__(self)
     #which texture uuids with mediaurl are in which webview wrapper
     self.texture2mediaurlview = {}
Пример #39
0
#!/usr/bin/env python

from circuits import Component

Component().run()
Пример #40
0
 def __init__(self):
     Component.__init__(self)
     self.data = 1
Пример #41
0
    def __init__(self):
        self.sels = []
        self.selmasses = {}
        Component.__init__(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()
        self.usingManipulator = False
        self.useLocalTransform = False
        #self.cpp_python_handler = None
        self.left_button_down = False
        self.keypressed = False
        self.editing = False

        self.editingKeyTrigger = (Qt.Key_M, Qt.ShiftModifier)
        self.shortcuts = {
            self.editingKeyTrigger: self.toggleEditingKeyTrigger,
            (Qt.Key_R, Qt.NoModifier): self.rotateObject,
            (Qt.Key_S, Qt.NoModifier): self.scaleObject,
            (Qt.Key_G, Qt.NoModifier): self.translateObject,
            (Qt.Key_Tab, Qt.NoModifier): self.cycleManipulator,
            (Qt.Key_Z, Qt.ControlModifier): self.undo,
            (Qt.Key_Delete, Qt.NoModifier): self.deleteObject,
            (Qt.Key_L, Qt.AltModifier): self.linkObjects,
            (Qt.Key_L, Qt.ControlModifier | Qt.ShiftModifier):
            self.unlinkObjects,
        }

        # Connect to key pressed signal from input context
        self.edit_inputcontext = naali.createInputContext("object-edit", 100)
        self.edit_inputcontext.SetTakeMouseEventsOverQt(True)
        #print "connecting to",self.edit_inputcontext
        self.edit_inputcontext.connect('KeyPressed(KeyEvent*)',
                                       self.on_keypressed)

        # Connect to mouse events
        self.edit_inputcontext.connect('MouseScroll(MouseEvent*)',
                                       self.on_mousescroll)
        self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)',
                                       self.on_mouseleftpressed)
        self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)',
                                       self.on_mouseleftreleased)
        self.edit_inputcontext.connect('MouseMove(MouseEvent*)',
                                       self.on_mousemove)

        self.resetManipulators()

        self.selection_rect = QRect()
        self.selection_rect_startpos = None

        r.c = self  #this is for using objectedit from command.py

        self.selection_box_entity = None
        self.selection_box = None
        self.selection_box_inited = False

        self.menuToggleAction = None
        mainWindow = naali.ui.MainWindow()
        print mainWindow
        if mainWindow:
            menuBar = mainWindow.menuBar()
            self.menuToggleAction = menuBar.addAction("Manipulation Toggle")
            self.menuToggleAction.connect("triggered()",
                                          self.toggleEditingKeyTrigger)
        self.toggleEditing(False)
        """
Пример #42
0
    def __init__(self):
        Component.__init__(self)
        #which texture uuids with mediaurl are in which canvas impl
        self.texture2canvas = {}

        """
Пример #43
0
 def __init__(self):
     Component.__init__(self)
     self.data = 1
Пример #44
0
    def __init__(self, dkv, channel=channel):
        Component.__init__(self, channel=channel)
        self.dkv = dkv

        self.fire(TestUpdate())
        Timer(5.0, TestUpdate(), "dkv_test", persist=True).register(self)
Пример #45
0
 def __init__(self):
     log("RaspuinoDartMini::__init__")
     Component.__init__(self)
     RaspuinoDartMiniGame().register(self)
     RaspuinoDartMiniServer().register(self)
     RaspuinoDartMiniBoard().register(self)
Пример #46
0
    def __init__(self):
        self.sels = []
        Component.__init__(self)
        self.window = window.ObjectEditWindow(self)
        self.resetValues()
        self.worldstream = r.getServerConnection()
        self.usingManipulator = False
        self.useLocalTransform = False
        self.cpp_python_handler = None
        self.left_button_down = False
        self.keypressed = False

        self.shortcuts = {
            (Qt.Key_Z, Qt.ControlModifier): self.undo,
            (Qt.Key_Delete, Qt.NoModifier): self.deleteObject,
            (Qt.Key_L, Qt.AltModifier): self.linkObjects,
            (Qt.Key_L, Qt.ControlModifier | Qt.ShiftModifier):
            self.unlinkObjects,
        }

        # Connect to key pressed signal from input context
        self.edit_inputcontext = naali.createInputContext("object-edit", 100)
        self.edit_inputcontext.SetTakeMouseEventsOverQt(True)
        self.edit_inputcontext.connect('KeyPressed(KeyEvent*)',
                                       self.on_keypressed)

        # Connect to mouse events
        self.edit_inputcontext.connect('MouseScroll(MouseEvent*)',
                                       self.on_mousescroll)
        self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)',
                                       self.on_mouseleftpressed)
        self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)',
                                       self.on_mouseleftreleased)
        self.edit_inputcontext.connect('MouseMove(MouseEvent*)',
                                       self.on_mousemove)

        self.resetManipulators()

        loader = QUiLoader()
        selectionfile = QFile(self.SELECTIONRECT)
        self.selection_rect = loader.load(selectionfile)
        #rectprops = r.createUiWidgetProperty(2)
        #~ print type(rectprops), dir(rectprops)
        #print rectprops.WidgetType
        #uiprops.widget_name_ = "Selection Rect"

        #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it
        proxy = r.createUiProxyWidget(self.selection_rect)
        uism = naali.ui
        uism.AddWidgetToScene(proxy)
        proxy.setWindowFlags(0)  #changing it to Qt::Widget

        self.selection_rect.setGeometry(0, 0, 0, 0)
        self.selection_rect_startpos = None

        r.c = self  #this is for using objectedit from command.py

        # Get world building modules python handler
        self.cpp_python_handler = r.getQWorldBuildingHandler()
        if self.cpp_python_handler == None:
            r.logDebug(
                "Could not aqquire world building service to object edit")
        else:
            # Connect signals
            self.cpp_python_handler.connect('ActivateEditing(bool)',
                                            self.on_activate_editing)
            self.cpp_python_handler.connect('ManipulationMode(int)',
                                            self.on_manupulation_mode_change)
            self.cpp_python_handler.connect('RemoveHightlight()',
                                            self.deselect_all)
            self.cpp_python_handler.connect(
                'RotateValuesToNetwork(int, int, int)', self.changerot_cpp)
            self.cpp_python_handler.connect(
                'ScaleValuesToNetwork(double, double, double)',
                self.changescale_cpp)
            self.cpp_python_handler.connect(
                'PosValuesToNetwork(double, double, double)',
                self.changepos_cpp)
            self.cpp_python_handler.connect('CreateObject()',
                                            self.createObject)
            self.cpp_python_handler.connect('DuplicateObject()',
                                            self.duplicate)
            self.cpp_python_handler.connect('DeleteObject()',
                                            self.deleteObject)
            # Pass widgets
            self.cpp_python_handler.PassWidget("Mesh", self.window.mesh_widget)
            self.cpp_python_handler.PassWidget("Animation",
                                               self.window.animation_widget)
            self.cpp_python_handler.PassWidget("Sound",
                                               self.window.sound_widget)
            self.cpp_python_handler.PassWidget(
                "Materials", self.window.materialTabFormWidget)
            # Check if build mode is active, required on python restarts
            self.on_activate_editing(
                self.cpp_python_handler.IsBuildingActive())
Пример #47
0
    def __init__(self):
        log("RaspuinoDartGame::__init__")
        Component.__init__(self)
        self.currentMatch = None
        self.playerData = {}
        self.matchData = {}
        self.matchTypes = {
            0: {
                "short": "301",
                "description": "301"
            },
            1: {
                "short": "301D",
                "description": "301 double out"
            },
            2: {
                "short": "301T",
                "description": "301 triple out"
            },
            3: {
                "short": "501",
                "description": "501"
            },
            4: {
                "short": "501D",
                "description": "501 double out"
            },
            5: {
                "short": "501T",
                "description": "501 triple out"
            },
            6: {
                "short": "CRK",
                "description": "Cricket"
            },
            7: {
                "short": "CRKF",
                "description": "Cricket (fair)"
            },
            8: {
                "short": "CTCRK",
                "description": "Cut-throat Cricket"
            },
            9: {
                "short": "CTCRKF",
                "description": "Cut-throat Cricket (fair)"
            },
        }

        # set some starting values for now
        self.playerData = {
            0: {
                "id": 0,
                "name": "Sascha",
                "joined": "20170210-000000",
                "matches": [0, 1]
            },
            1: {
                "id": 1,
                "name": "Heike",
                "joined": "20170210-000000",
                "matches": []
            },
            2: {
                "id": 2,
                "name": "Michi",
                "joined": "20170210-000000",
                "matches": [0, 1]
            },
            3: {
                "id": 3,
                "name": "Jochen",
                "joined": "20170210-000000",
                "matches": [0, 1]
            },
        }
        self.matchData = {
            0: {
                "type": 0,
                "datetime": datetime.now().strftime("%Y%m%d-%H%M%S"),
                "players": [0, 2, 3],
                "history": []
            },
            1: {
                "type": 0,
                "datetime": datetime.now().strftime("%Y%m%d-%H%M%S"),
                "players": [3, 0, 2],
                "history": []
            }
        }
Пример #48
0
 def __init__(self):
     Component.__init__(self)
     #which texture uuids with mediaurl are in which webview wrapper
     self.texture2mediaurlview = {}
Пример #49
0
 def __init__(self, uniquename=None, *args, **kwargs):
     Component.__init__(self, *args, **kwargs)
     LoggingMeta.__init__(self, uniquename=uniquename, *args, **kwargs)
Пример #50
0
 def __init__(self):
     Component.__init__(self)
     self.scene = None #now just to know when can perhaps soon get the cam
     self.cam = None
Пример #51
0
 def __init__(self):
     Component.__init__(self)
     self._commService = naali.communicationsservice
     self._voiceSession = None
     self._indicators = {}
     self._commService.connect("InWorldVoiceAvailable()", self.onNewVoiceSession)
Пример #52
0
 def __init__(self, uniquename=None, *args, **kwargs):
     ConfigurableMeta.__init__(self, uniquename)
     Component.__init__(self, *args, **kwargs)
Пример #53
0
	def __init__(self, filename, defaults=None):
		Component.__init__(self)
		ConfigParser.__init__(self, defaults=defaults)

		self.filename = filename
Пример #54
0
 def __init__(self):
     Component.__init__(self)
     self.scene = None  # now just to know when can perhaps soon get the cam
     self.cam = None
Пример #55
0
 def __init__(self, one_game = False):
     Component.__init__(self)
     self.state = GameState([], 0, None, True)
     self.one_game = one_game