示例#1
0
    def init(self):
        skin_config.wrap_skin_window(self)
        self.set_decorated(False)
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.window_shadow = gtk.Alignment()
        self.window_frame = gtk.VBox()
        self.shadow_is_visible = True
        self.cursor_type = None

        # Shadow setup.
        if enable_shadow(self) and self.shadow_visible:
            self.shadow_padding = self.shadow_radius - self.frame_radius
            self.window_frame.connect("size-allocate", self.shape_window_frame)
            self.window_shadow.connect("expose-event", self.expose_window_shadow)
        else:
            # Disable shadow when composited is false.
            self.shadow_padding = 0
            self.connect("size-allocate", self.shape_window_frame)

        # Init window frame.
        self.window_shadow.set(0.0, 0.0, 1.0, 1.0)
        self.window_shadow.set_padding(self.shadow_padding, self.shadow_padding, self.shadow_padding, self.shadow_padding)

        # Connect widgets.
        self.add(self.window_shadow)
        self.window_shadow.add(self.window_frame)

        # Handle signal.
        self.connect_after("expose-event", self.expose_window_background)
        self.connect_after("size-allocate", lambda w, e: self.queue_draw())
        self.connect("motion-notify-event", self.motion_notify)
        self.connect("leave-notify-event", self.leave_notify)
        self.connect("button-press-event", self.resize_window)
        self.connect("window-state-event", self.monitor_window_state)
        self.window_frame.connect("expose-event", self.expose_window_frame)
示例#2
0
 def __init__(self, 
              width, 
              height, 
              window_type=gtk.WINDOW_TOPLEVEL):
     '''
     Initialize Panel class.
     
     @param width: Initialize panel width.
     @param height: Initialize panel height.
     @param window_type: Window type, default is gtk.WINDOW_TOPLEVEL.
     '''
     # Init.
     gtk.Window.__init__(self, window_type)
     skin_config.wrap_skin_window(self)
     self.set_decorated(False)
     self.set_colormap(gtk.gdk.Screen().get_rgba_colormap())
     self.add_events(gtk.gdk.ALL_EVENTS_MASK)        
     self.set_skip_taskbar_hint(True)
     self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) # make panel window don't switch in window manager
     self.start_show_id = None
     self.start_hide_id = None
     self.delay = 50         # milliseconds
     self.show_inc_opacity = 0.1
     self.hide_dec_opacity = 0.05
     self.width = width
     self.height = height
     self.set_size_request(self.width, self.height)
     
     # Change shape.
     self.connect("size-allocate", self.shape_panel)
示例#3
0
    def init(self):
        skin_config.wrap_skin_window(self)
        self.set_decorated(False)
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.frame_radius = 2
        self.shadow_is_visible = True
        self.window_frame = gtk.VBox()
        self.add(self.window_frame)
        self.shape_flag = True
        
        if enable_shadow(self) and self.shadow_visible:
            self.shadow_padding = self.shadow_radius - self.frame_radius
        else:
            self.shadow_padding = 0
        
        # Init shadow window.
        if enable_shadow(self) and self.shadow_visible:    
            self.window_shadow = gtk.Window(gtk.WINDOW_TOPLEVEL)
            self.window_shadow.add_events(gtk.gdk.ALL_EVENTS_MASK)
            self.window_shadow.set_decorated(False)
            self.window_shadow.set_transient_for(self)
            self.window_shadow.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_MENU)

        # Handle signal.
        self.connect_after("expose-event", self.expose_window)
        self.connect("size-allocate", self.shape_window)
        self.connect("window-state-event", self.monitor_window_state)
        self.connect("configure-event", self.adjust_window_shadow)
        
        if enable_shadow(self) and self.shadow_visible:    
            self.window_shadow.connect("expose-event", self.expose_window_shadow)
            self.window_shadow.connect("size-allocate", self.shape_window_shadow)
            self.window_shadow.connect("button-press-event", self.resize_window)
            self.window_shadow.connect("motion-notify-event", self.motion_notify)
示例#4
0
    def __init__(self, width, height, window_type=gtk.WINDOW_TOPLEVEL):
        '''
        Initialize Panel class.

        @param width: Initialize panel width.
        @param height: Initialize panel height.
        @param window_type: Window type, default is gtk.WINDOW_TOPLEVEL.
        '''
        # Init.
        gtk.Window.__init__(self, window_type)
        skin_config.wrap_skin_window(self)
        self.set_decorated(False)
        self.set_colormap(gtk.gdk.Screen().get_rgba_colormap())
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.set_skip_taskbar_hint(True)
        self.set_type_hint(
            gtk.gdk.WINDOW_TYPE_HINT_DIALOG
        )  # make panel window don't switch in window manager
        self.start_show_id = None
        self.start_hide_id = None
        self.delay = 50  # milliseconds
        self.show_inc_opacity = 0.1
        self.hide_dec_opacity = 0.05
        self.width = width
        self.height = height
        self.set_size_request(self.width, self.height)

        # Change shape.
        self.connect("size-allocate", self.shape_panel)
示例#5
0
    def __init__(self, enable_resize=False, shadow_radius=6, window_type=gtk.WINDOW_TOPLEVEL):
        '''Init mplayer window.'''
        # Init.
        gtk.Window.__init__(self, window_type)
        skin_config.wrap_skin_window(self)
        self.set_decorated(False)
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.shadow_radius = shadow_radius
        self.frame_radius = 2
        self.shadow_is_visible = True
        self.enable_resize = enable_resize
        self.window_frame = gtk.VBox()
        self.add(self.window_frame)
        self.shape_flag = True
        
        # FIXME: Because mplayer don't allowed window redirect colormap to screen.
        # We build shadow window to emulate it, but shadow's visual effect 
        # is not good enough, so we disable shadow temporary for future fixed.
        self.shadow_visible = False
        
        if enable_shadow(self) and self.shadow_visible:
            self.shadow_padding = self.shadow_radius - self.frame_radius
        else:
            self.shadow_padding = 0
        
        # Init shadow window.
        if enable_shadow(self) and self.shadow_visible:    
            self.window_shadow = gtk.Window(gtk.WINDOW_TOPLEVEL)
            self.window_shadow.add_events(gtk.gdk.ALL_EVENTS_MASK)
            self.window_shadow.set_decorated(False)
            self.window_shadow.set_colormap(gtk.gdk.Screen().get_rgba_colormap())
            self.window_shadow.set_transient_for(self)
            self.window_shadow.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_MENU)

        # Handle signal.
        self.connect_after("expose-event", self.expose_window)
        self.connect("size-allocate", self.shape_window)
        self.connect("window-state-event", self.monitor_window_state)
        self.connect("configure-event", self.adjust_window_shadow)
        
        if enable_shadow(self) and self.shadow_visible:    
            self.window_shadow.connect("expose-event", self.expose_window_shadow)
            self.window_shadow.connect("size-allocate", self.shape_window_shadow)
            self.window_shadow.connect("button-press-event", self.resize_window)
            self.window_shadow.connect("motion-notify-event", self.motion_notify)
示例#6
0
 def __init__(self, enable_resize=False, shadow_radius=6, window_type=gtk.WINDOW_TOPLEVEL, shadow_visible=True):
     '''Init window.'''
     # Init.
     gtk.Window.__init__(self, window_type)
     skin_config.wrap_skin_window(self)
     self.set_decorated(False)
     self.set_colormap(gtk.gdk.Screen().get_rgba_colormap())
     self.add_events(gtk.gdk.ALL_EVENTS_MASK)
     self.window_shadow = gtk.Alignment()
     self.window_frame = gtk.VBox()
     self.shadow_radius = shadow_radius
     self.frame_radius = 2
     self.shadow_is_visible = True
     self.cursor_type = None
     self.enable_resize = enable_resize
     self.shadow_visible = shadow_visible
     
     # Shadow setup.
     if enable_shadow(self) and self.shadow_visible:
         self.shadow_padding = self.shadow_radius - self.frame_radius
         self.window_frame.connect("size-allocate", self.shape_window_frame)
         self.window_shadow.connect("expose-event", self.expose_window_shadow)
     else:
         # Disable shadow when composited is false.
         self.shadow_padding = 0
         self.connect("size-allocate", self.shape_window_frame)
     
     # Init window frame.
     self.window_shadow.set(0.0, 0.0, 1.0, 1.0)
     self.window_shadow.set_padding(self.shadow_padding, self.shadow_padding, self.shadow_padding, self.shadow_padding)
     
     # Connect widgets.
     self.add(self.window_shadow)
     self.window_shadow.add(self.window_frame)
     
     # Handle signal.
     self.connect_after("expose-event", self.expose_window_background)
     self.connect_after("size-allocate", lambda w, e: self.queue_draw())
     self.connect("motion-notify-event", self.motion_notify)
     self.connect("button-press-event", self.resize_window)
     self.connect("window-state-event", self.monitor_window_state)
     self.window_frame.connect("expose-event", self.expose_window_frame)
示例#7
0
    def init(self):
        skin_config.wrap_skin_window(self)
        self.set_decorated(False)
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.window_shadow = gtk.Alignment()
        self.window_frame = gtk.VBox()
        self.shadow_is_visible = True
        self.cursor_type = None

        # Shadow setup.
        if enable_shadow(self) and self.shadow_visible:
            self.shadow_padding = self.shadow_radius - self.frame_radius
            self.window_frame.connect("size-allocate", self.shape_window_frame)
            self.window_shadow.connect("expose-event",
                                       self.expose_window_shadow)
        else:
            # Disable shadow when composited is false.
            self.shadow_padding = 0
            self.connect("size-allocate", self.shape_window_frame)

        # Init window frame.
        self.window_shadow.set(0.0, 0.0, 1.0, 1.0)
        self.window_shadow.set_padding(self.shadow_padding,
                                       self.shadow_padding,
                                       self.shadow_padding,
                                       self.shadow_padding)

        # Connect widgets.
        self.add(self.window_shadow)
        self.window_shadow.add(self.window_frame)

        # Handle signal.
        self.connect_after("expose-event", self.expose_window_background)
        self.connect_after("size-allocate", lambda w, e: self.queue_draw())
        self.connect("motion-notify-event", self.motion_notify)
        self.connect("leave-notify-event", self.leave_notify)
        self.connect("button-press-event", self.resize_window)
        self.connect("window-state-event", self.monitor_window_state)
        self.window_frame.connect("expose-event", self.expose_window_frame)
示例#8
0
    def init(self):
        skin_config.wrap_skin_window(self)
        self.set_decorated(False)
        self.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.frame_radius = 2
        self.shadow_is_visible = True
        self.window_frame = gtk.VBox()
        self.add(self.window_frame)
        self.shape_flag = True

        if enable_shadow(self) and self.shadow_visible:
            self.shadow_padding = self.shadow_radius - self.frame_radius
        else:
            self.shadow_padding = 0

        # Init shadow window.
        if enable_shadow(self) and self.shadow_visible:
            self.window_shadow = gtk.Window(gtk.WINDOW_TOPLEVEL)
            self.window_shadow.add_events(gtk.gdk.ALL_EVENTS_MASK)
            self.window_shadow.set_decorated(False)
            self.window_shadow.set_transient_for(self)
            self.window_shadow.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_MENU)

        # Handle signal.
        self.connect_after("expose-event", self.expose_window)
        self.connect("size-allocate", self.shape_window)
        self.connect("window-state-event", self.monitor_window_state)
        self.connect("configure-event", self.adjust_window_shadow)

        if enable_shadow(self) and self.shadow_visible:
            self.window_shadow.connect("expose-event",
                                       self.expose_window_shadow)
            self.window_shadow.connect("size-allocate",
                                       self.shape_window_shadow)
            self.window_shadow.connect("button-press-event",
                                       self.resize_window)
            self.window_shadow.connect("motion-notify-event",
                                       self.motion_notify)