Пример #1
0
    def build_window(self):
        icopath = self._get_icon_location()
        Application.build_window(self)
        self.window.connect('save-dimensions', self.set_main_window_dimensions)
        self.window.connect('save-maximized', self.set_main_window_maximized)

        maximized = self.get_main_window_maximized()
        if maximized != None:
            if maximized:
                self.window._window.maximize()
            else:
                self.window._window.unmaximize()

        self.trayicon = trayicon.Trayicon(icopath)
        if app.config.get(options.SHOW_TRAYICON):
            self.trayicon.set_visible(True)
        else:
            self.trayicon.set_visible(False)

        if app.config.get(options.WINDOW_DIMENSIONS) == "":
            # Miro is being started for the first time on this computer
            # so we do some figuring to make sure the default width/height
            # fit on this monitor.
            geom = self.window.get_monitor_geometry()
            width = min(1024, geom.width)
            height = min(600, geom.height)
            self.window.set_frame(width=width, height=height)
        else:
            # check x, y to make sure the window is visible and fix it
            # if not
            self.window.check_position_and_fix()
Пример #2
0
    def build_window(self):
        self._set_default_icon()
        Application.build_window(self)
        self.window.connect('save-dimensions', self.set_main_window_dimensions)
        self.window.connect('save-maximized', self.set_main_window_maximized)

        # handle maximized
        maximized = self.get_main_window_maximized()
        if maximized != None:
            if maximized:
                self.window._window.maximize()
            else:
                self.window._window.unmaximize()

        # handle the trayicon
        if APP_INDICATOR_SUPPORT:
            self.trayicon = miroappindicator.MiroAppIndicator('miro')
        else:
            self.trayicon = trayicon.Trayicon('miro')

        if app.config.get(options.SHOW_TRAYICON):
            self.trayicon.set_visible(True)
        else:
            self.trayicon.set_visible(False)

        if options.override_dimensions:
            # if the user specified override dimensions on the command
            # line, set them here.
            self.window.set_frame(
                width=options.override_dimensions[0],
                height=options.override_dimensions[1])

        elif not get_int("width") and not get_int("height"):
            # if this is the first time Miro has been started, we want
            # to set a default size that makes sense in the context of
            # their monitor resolution.  the check here is against
            # whether there are width/height values in gconf already
            # which isn't true in a first-run situation.
            geom = self.window.get_monitor_geometry()
            width = min(1024, geom.width)
            height = min(600, geom.height)
            self.window.set_frame(width=width, height=height)

        else:
            # the user isn't overriding dimensions and this is not the
            # first time Miro has been launched on this computer, so
            # we double-check that the position works on this monitor
            # and if it puts Miro in a bad place, then fix it.
            self.window.check_position_and_fix()

        # handle media keys
        self.mediakeyhandler = mediakeys.get_media_key_handler(self.window)