Пример #1
0
    def overlayImage(self, call_id, x, y, img_str, img_width, timeout):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        img_bytes = base64.b64decode(img_str)
        self._overlay.enqueue(call_id, "overlay_image", img_bytes, x, y,
                              img_width, timeout)
Пример #2
0
    def setTaskbarProgress(self, type_: QJsonValue, progress: QJsonValue):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        type_map = {
            0: "RESET",
            1: "IN_PROGRESS",
            2: "ERROR",
            3: "LOADING",
            4: "PAUSED",
        }
        # This can be called with null, but since the default value is 0 we call RESET anyway
        self.app.game_instance.set_taskbar_progress(
            type_map[type_.toDouble(0)], progress.toDouble(0))
Пример #3
0
    def bind_get_region_raw(self, id, x, y, w, h):
        if not self.app.has_permission("pixel"):
            raise ApiPermissionDeniedException("pixel")

        if id == 0:
            return ""

        try:
            image = self._bound_regions[id - 1]
        except IndexError:
            self.logger.warning("bindGetRegionRaw(%d) but image not bound", id)
            return ""

        return image_to_stream(image.image, x, y, w, h, mode="rgba")
Пример #4
0
    def overlayTextEx(self, call_id, message, color, size, x, y, timeout,
                      font_name, centered, shadow):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self._overlay.enqueue(
            call_id,
            "overlay_text",
            message,
            color,
            size,
            x,
            y,
            timeout,
            font_name,
            centered,
            shadow,
        )
Пример #5
0
    def overlaySetGroupZIndex(self, call_id, group, zIndex):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self._overlay.enqueue(call_id, "overlay_set_group_z", group, zIndex)
Пример #6
0
    def overlayRefreshGroup(self, call_id, name):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self._overlay.enqueue(call_id, "overlay_refresh_group", name)
Пример #7
0
    def overlayContinueGroup(self, call_id, name):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self._overlay.enqueue(call_id, "overlay_continue_group", name)
Пример #8
0
    def overlayLine(self, call_id, color, width, x1, y1, x2, y2, timeout):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self._overlay.enqueue(call_id, "overlay_line", color, width, x1, y1,
                              x2, y2, timeout)
Пример #9
0
    def overlayRect(self, call_id, color, x, y, w, h, timeout, line_width):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self._overlay.enqueue(call_id, "overlay_rect", color, x, y, w, h,
                              timeout, line_width)
Пример #10
0
    def showNotification(self, title, message, icon):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        tray_icon().showMessage(title, message)
Пример #11
0
    def setTooltip(self, text: str):
        if not self.app.has_permission("overlay"):
            raise ApiPermissionDeniedException("overlay")

        self.app.host.notifier.notify(str(text))
Пример #12
0
    def get_region_raw(self, x, y, w, h):
        if not self.app.has_permission("pixel"):
            raise ApiPermissionDeniedException("pixel")

        return image_to_stream(self.app.game_instance.grab_region(x, y, w, h),
                               mode="rgba")
Пример #13
0
    def get_region(self, x, y, w, h):
        if not self.app.has_permission("pixel"):
            raise ApiPermissionDeniedException("pixel")

        return base64.b64encode(
            image_to_stream(self.app.game_instance.grab_region(x, y, w, h)))