예제 #1
0
    def _get_font(self):
        font_name = self.font_name

        if not font_name:
            stop_alert("render native unable to find a valid font name, please use --font_name or pymterm.json to set font name")
            sys.exit(1)

        return GUI.Font(family=font_name,
                        size=self.font_size)
예제 #2
0
	def report_error(self):
		"""Display an appropriate error message for the most recent
		exception caught."""
		try:
			raise
		except Cancel:
			pass
		except ApplicationError, e:
			from GUI.Alerts import stop_alert
			stop_alert(str(e))
예제 #3
0
    def report_error(self):
        """Display an appropriate error message for the most recent
        exception caught."""
        try:
            raise
        except Cancel:
            pass
        except ApplicationError, e:
            from GUI.Alerts import stop_alert

            stop_alert(str(e))
    def _get_font(self):
        font_path = self.font_file

        if not font_path:
            stop_alert("render pygame unable to find a valid font file, please use --font_file or pymterm.json to set font file")
            sys.exit(1)

        if use_freetype:
            font = pygame.freetype.Font(font_path,
                                                self.font_size)
        else:
            font = pygame.font.Font(font_path,
                                            int(self.font_size))
        return font
    def _get_font(self):
        font_map = pangocairo.cairo_font_map_get_default()
        font_name = self.font_name

        if not font_name:
            stop_alert("render cairoe unable to find a valid font name, please use --font_name or pymterm.json to set font name")
            sys.exit(1)

        font = self._find_font_desc(font_name)

        if not font:
            font = pango.FontDescription(' '.join([font_name, str(self.font_size)]))
        else:
            font.set_size(int(float(self.font_size) * pango.SCALE * 72 / font_map.get_resolution()) + 1)

        return font
예제 #6
0
    def _select_view_render(self):
        render = self.cfg.render
        _cls_view = None

        if render and render in self.cfg.gui_renders:
            _cls_view = self._try_import_render(render)

        if _cls_view:
            return _cls_view

        for render in self.cfg.gui_renders:
            _cls_view = self._try_import_render(render)
            if _cls_view:
                return _cls_view

        logging.getLogger('term_pygui').error("unable to find a valid render")

        stop_alert("unable to find a valid render, supported render:{}".format(self.cfg.renders))
예제 #7
0
    def _select_view_render(self):
        render = self.cfg.render
        _cls_view = None

        if render and render in self.cfg.gui_renders:
            _cls_view = self._try_import_render(render)

        if _cls_view:
            return _cls_view

        for render in self.cfg.gui_renders:
            _cls_view = self._try_import_render(render)
            if _cls_view:
                return _cls_view

        logging.getLogger('term_pygui').error("unable to find a valid render")

        stop_alert("unable to find a valid render, supported render:{}".format(
            self.cfg.renders))
예제 #8
0
    def _get_font(self):
        font_map = pangocairo.cairo_font_map_get_default()
        font_name = self.font_name

        if not font_name:
            stop_alert(
                "render cairoe unable to find a valid font name, please use --font_name or pymterm.json to set font name"
            )
            sys.exit(1)

        font = self._find_font_desc(font_name)

        if not font:
            font = pango.FontDescription(' '.join(
                [font_name, str(self.font_size)]))
        else:
            font.set_size(
                int(
                    float(self.font_size) * pango.SCALE * 72 /
                    font_map.get_resolution()) + 1)

        return font
예제 #9
0
파일: 17-alerts.py 프로젝트: tomihasa/pygui
def do_stop_alert():
    stop_alert("Too much tapioca.")
예제 #10
0
 def report_error(self, msg):
     self.__alert_task = Task(lambda: stop_alert(msg), .001)
예제 #11
0
 def report_error(self, msg):
     self.__alert_task = Task(lambda : stop_alert(msg), .001)
예제 #12
0
def do_stop_alert():
    stop_alert("Too much tapioca.")