Exemple #1
0
 def drag_data_received(self, widget, context, x, y, selection, info, t):
     if info == 1:
         if selection.data:
             uri = selection.data.split("\r\n")[0]
             fn = helpers.uri2filename(uri)
             if os.path.exists(fn):
                 if self.app.filehandler.confirm_destructive_action():
                     self.app.filehandler.open_file(fn)
     elif info == 2:  # color
         color = RGBColor.new_from_drag_data(selection.data)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)
 def drag_data_received(self, widget, context, x, y, selection, info, t):
     if info == 1:
         if selection.data:
             uri = selection.data.split("\r\n")[0]
             fn = helpers.uri2filename(uri)
             if os.path.exists(fn):
                 if self.app.filehandler.confirm_destructive_action():
                     self.app.filehandler.open_file(fn)
     elif info == 2: # color
         color = RGBColor.new_from_drag_data(selection.data)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)
Exemple #3
0
 def _drag_data_received_cb(self, widget, context, x, y, data, info, time):
     """Handles data being received"""
     rawdata = data.get_data()
     if not rawdata:
         return
     if info == 1: # file uris
         uri = rawdata.split("\r\n")[0]
         fn = helpers.uri2filename(uri)
         if os.path.exists(fn):
             if self.app.filehandler.confirm_destructive_action():
                 self.app.filehandler.open_file(fn)
     elif info == 2: # color
         color = RGBColor.new_from_drag_data(rawdata)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)