Exemplo n.º 1
0
    def _build_window(self, interactive=True):
        ''' Initialize the TurtleWindow instance. '''
        if interactive:
            win = self.canvas.get_window()
            cr = win.cairo_create()
            surface = cr.get_target()
        else:
            img_surface = cairo.ImageSurface(cairo.FORMAT_RGB24,
                                             1024, 768)
            cr = cairo.Context(img_surface)
            surface = cr.get_target()
        self.turtle_canvas = surface.create_similar(
            cairo.CONTENT_COLOR,
            # max(1024,  Gdk.Screen.width() * 2),
            # max(768, Gdk.Screen.height() * 2))
            Gdk.Screen.width() * 2,
            Gdk.Screen.height() * 2)

        # Make sure the autosave directory is writeable
        if is_writeable(self._share_path):
            self._autosavedirname = self._share_path
        else:
            self._autosavedirname = os.path.expanduser('~')
        self.tw = TurtleArtWindow(
            self.canvas,
            self._lib_path,
            self._share_path,
            turtle_canvas=self.turtle_canvas,
            activity=self,
            running_sugar=False)
        self.tw.save_folder = self._abspath  # os.path.expanduser('~')

        if interactive:
            if self._settings.get_int(self._HOVER_HELP) == 1:
                self.tw.no_help = True
                self.hover.set_active(False)
                self._do_hover_help_off_cb()
            if not self._settings.get_int(self._COORDINATE_SCALE) in [0, 1]:
                self.tw.coord_scale = 1
            else:
                self.tw.coord_scale = 0
            if self._settings.get_int(self._ORIENTATION) == 1:
                self.tw.orientation = 1
        else:
            self.tw.coord_scale = 1
    def _build_window(self, interactive=True):
        ''' Initialize the TurtleWindow instance. '''
        if interactive:
            win = self.canvas.get_window()
            cr = win.cairo_create()
            surface = cr.get_target()
        else:
            img_surface = cairo.ImageSurface(cairo.FORMAT_RGB24,
                                             1024, 768)
            cr = cairo.Context(img_surface)
            surface = cr.get_target()
        self.turtle_canvas = surface.create_similar(
            cairo.CONTENT_COLOR,
            # max(1024,  Gdk.Screen.width() * 2),
            # max(768, Gdk.Screen.height() * 2))
            Gdk.Screen.width() * 2,
            Gdk.Screen.height() * 2)

        # Make sure the autosave directory is writeable
        if is_writeable(self._share_path):
            self._autosavedirname = self._share_path
        else:
            self._autosavedirname = os.path.expanduser('~')
        self.tw = TurtleArtWindow(
            self.canvas,
            self._lib_path,
            self._share_path,
            turtle_canvas=self.turtle_canvas,
            activity=self,
            running_sugar=False)
        self.tw.save_folder = self._abspath  # os.path.expanduser('~')

        if interactive:
            if self._settings.get_int(self._HOVER_HELP) == 1:
                self.tw.no_help = True
                self.hover.set_active(False)
                self._do_hover_help_off_cb()
            if not self._settings.get_int(self._COORDINATE_SCALE) in [0, 1]:
                self.tw.coord_scale = 1
            else:
                self.tw.coord_scale = 0
            if self._settings.get_int(self._ORIENTATION) == 1:
                self.tw.orientation = 1
        else:
            self.tw.coord_scale = 1