Beispiel #1
0
    def add_move_event(self, widget):
        '''
        Add move event callback.

        @param widget: A widget of type gtk.Widget.
        '''
        widget.connect("button-press-event", lambda w, e: move_window(w, e, self))            
Beispiel #2
0
    def add_move_event(self, widget):
        '''
        Add move event callback.

        @param widget: A widget of type gtk.Widget.
        '''
        widget.connect("button-press-event",
                       lambda w, e: move_window(w, e, self))
Beispiel #3
0
 def button_press_slider(self, widget, event):
     '''Button press slider.'''
     rect = widget.allocation
     (window_x, window_y) = widget.get_toplevel().window.get_origin()
     if (self.slide_index == self.slider_number - 1
         and is_in_rect((event.x_root, event.y_root), 
                        (window_x + rect.width - self.close_area_width,
                         window_y,
                         self.close_area_width,
                         self.close_area_height))):
         if self.finish_callback:
             self.finish_callback()
             
         self.destroy()    
     else:
         widget.connect("button-press-event", lambda w, e: move_window(w, e, self))            
Beispiel #4
0
 def __init__(self, parent_widget=None, widget=None, x=None, y=None):
     '''Init PopupWindow.'''        
     Window.__init__(self)
     
     # Init Window.
     self.set_position(gtk.WIN_POS_MOUSE)
     self.set_modal(True)
     self.set_size_request(200,300)
     
     self.main_box = gtk.VBox()
     self.titlebar = Titlebar(["close"])
     self.titlebar.close_button.connect("clicked", lambda w: self.destroy())
     self.scrolled_align  = gtk.Alignment()
     self.scrolled_align.set(0.0, 0.0, 1.0, 1.0)
     self.scrolled_window = ScrolledWindow(gtk.POLICY_NEVER)
     self.scrolled_align.add(self.scrolled_window)
     self.scrolled_align.set_padding(10, 10, 10, 10)
     
     if widget:
         self.scrolled_window.add_child(widget)
     else:
         self.buffer = gtk.TextBuffer()
         self.text_view = gtk.TextView(self.buffer)
         self.buffer.set_text("Linux Deepin")
         self.scrolled_window.add_child(self.text_view)
         
     if x and y:
         self.move(x, y)
         
     self.titlebar.drag_box.connect('button-press-event', lambda w, e: move_window(w, e, self))
         
     if parent_widget:
         self.connect("show", lambda w:self.show_window(w, parent_widget))
         
     self.main_box = gtk.VBox()
     self.main_box.pack_start(self.titlebar, False, False)
     self.main_box.pack_start(self.scrolled_align, True, True)
     
     self.window_frame.add(self.main_box)
     
     self.show_all()
Beispiel #5
0
 def add_move_event(self, widget):
     '''Add move window event.'''
     widget.connect("button-press-event", lambda w, e: move_window(w, e, self))