示例#1
0
    def on_show(self, widget):
        # restore window position, size and state
        if options.has_option("window_x") and options.has_option("window_y") and \
           options.has_option("window_width") and options.has_option("window_height"):
            r = Gdk.Rectangle()
            (r.x, r.y) = (options.get("window_x"), options.get("window_y"))
            (r.width, r.height) = (options.get(
                "window_width"), options.get("window_height"))

            screen = self.get_screen()
            monitor_num = screen.get_monitor_at_point(r.x, r.y)
            g = screen.get_monitor_geometry(monitor_num)

            # only restore position and size if window left corner
            # is within the closest monitor
            if r.x >= g.x and r.x < g.x + g.width and \
               r.y >= g.y and r.y < g.y + g.height:
                logger.debug("closest monitor ({}) geometry = {}+{}, window geometry = {}+{}".format(
                    monitor_num, (g.x, g.y), (g.width, g.height), (r.x, r.y), (r.width, r.height)))
                self.move(r.x, r.y)
                self.resize(r.width, r.height)
        if options.get("window_fullscreen"):
            self.fullscreen()
        elif options.get("window_maximized"):
            self.maximize()
示例#2
0
 def on_show(self, widget):
     # restore window position, size and state
     if options.has_option("window_x") and options.has_option("window_y"):
         self.move(options.get("window_x"), options.get("window_y"))
     if options.has_option("window_width") and options.has_option("window_height"):
         self.resize(options.get("window_width"), options.get("window_height"))
     if options.get("window_fullscreen"):
         self.fullscreen()
     elif options.get("window_maximized"):
         self.maximize()