コード例 #1
0
    def _select_region_with_gui(self, request: NormcapData) -> NormcapData:
        """Show window(s) with screenshots and select region.

        Arguments:
            request {NormcapData} -- NormCap's session data

        Returns:
            dict -- Selected region {"bottom": <int>,
                                     "top": <int>,
                                     "left": <int>,
                                     "right": <int>,
                                     "monitor": <int>,
                                     "mode": <int>}
        """
        # Create dummy window plus one for every monitor
        root = _RootWindow(request.cli_args, request.platform)
        for shot in request.shots:
            _CropWindow(root, shot)
        root.mainloop()

        # Store result in request class
        result = root.props.crop_result
        if result:
            request.bottom = result["lower"]
            request.top = result["upper"]
            request.left = result["left"]
            request.right = result["right"]
            request.monitor = result["monitor"]
            request.mode = result["mode"]
        else:
            self._logger.info("Exiting. No selection done.")
            sys.exit(0)

        return request
コード例 #2
0
ファイル: crop_handler.py プロジェクト: hoonkai/normcap
    def _select_region(self, request: NormcapData) -> NormcapData:
        """Show window(s) with screenshots and select region.

        Arguments:
            request {NormcapData} -- NormCap's session data

        Returns:
            dict -- Selected region {"bottom": <int>,
                                     "top": <int>,
                                     "left": <int>,
                                     "right": <int>,
                                     "monitor": <int>,
                                     "mode": <int>}
        """
        # Create dummy window plus one for every monitor
        # root = _RootWindow(request.cli_args, request.platform)
        # for shot in request.shots:
        # _CropWindow(root, shot)
        # root.mainloop()

        # Store result in request class
        # result = root.props.crop_result

        request.bottom = self.lower
        request.top = self.upper
        request.left = self.left
        request.right = self.right
        request.monitor = 0
        request.mode = 'parse'

        return request
コード例 #3
0
    def _select_region_with_gui(self, request: NormcapData) -> NormcapData:
        """Show window(s) with screenshots and select region.

        Arguments:
            request {NormcapData} -- NormCap's session data

        Returns:
            dict -- Selected region {"bottom": <int>,
                                     "top": <int>,
                                     "left": <int>,
                                     "right": <int>,
                                     "monitor": <int>,
                                     "mode": <int>}
        """
        # Create window for every monitor
        root = tkinter.Tk()
        for idx, shot in enumerate(request.shots):
            if idx == 0:
                _CropWindow(root, root, shot, request.cli_args)
            else:
                top = tkinter.Toplevel()
                _CropWindow(root, top, shot, request.cli_args)
        root.mainloop()

        # Store result in request class
        result = root.result
        if result:
            request.bottom = result["lower"]
            request.top = result["upper"]
            request.left = result["left"]
            request.right = result["right"]
            request.monitor = result["monitor"]
            request.mode = result["mode"]
        else:
            self._logger.info("Exiting. No selection done.")
            sys.exit(0)

        return request