def run(self): self.status = "" self.error = "" self.done = False cursor_position = os.environ.get("FSGS_RETURN_CURSOR_TO", "") try: x, y = cursor_position.split(",") x = int(x) y = int(y) except ValueError: pass else: # noinspection PyCallByClass,PyTypeChecker QCursor.setPos(x, y) # cursor_x = Settings.instance().get("__cursor_x") # cursor_y = Settings.instance().get("__cursor_y") # try: # cursor_x = int(cursor_x) # cursor_y = int(cursor_y) # except ValueError: # pass # else: # QCursor.setPos(cursor_x, cursor_y) threading.Thread(target=self._run_thread, name="GameRunnerRunThread").start()
def run(self): self.status = "" self.error = "" self.done = False cursor_position = os.environ.get("FSGS_RETURN_CURSOR_TO", "") try: x, y = cursor_position.split(",") x = int(x) y = int(y) except ValueError: pass else: # noinspection PyCallByClass,PyTypeChecker QCursor.setPos(x, y) # cursor_x = Settings.instance().get("__cursor_x") # cursor_y = Settings.instance().get("__cursor_y") # try: # cursor_x = int(cursor_x) # cursor_y = int(cursor_y) # except ValueError: # pass # else: # QCursor.setPos(cursor_x, cursor_y) threading.Thread( target=self._run_thread, name="GameRunnerRunThread" ).start()
def is_mouse_over(self): # noinspection PyArgumentList c = QCursor.pos() # noinspection PyUnresolvedReferences p = self.mapToGlobal(QPoint(0, 0)) s = self.get_size() if p.x() <= c.x() < p.x() + s[0] and p.y() <= c.y() < p.y() + s[1]: return True return False
def on_left_down(self): from fsui.qt import QCursor # noinspection PyArgumentList # FIXME: Remove direct Qt dependency p = self._widget.mapFromGlobal(QCursor.pos()) for start, stop, handler in self.coordinates: if start <= p.x() < stop and handler: # print(start, stop, handler) getattr(self, handler)()
def mousePressEvent(self, event): parent = self._parent() # noinspection PyArgumentList c = QCursor.pos() p = parent.widget().mapToGlobal(QPoint(0, 0)) s = parent.get_size() if p.x() <= c.x() < p.x() + s[0] and p.y() <= c.y() < p.y() + s[1]: # We want to close the menu (and not re-open it) if we click # on the widget used to open the menu. # parent._ignore_next_left_down_event = True pass super().mousePressEvent(event)