示例#1
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
         # Perhaps these should be handled as layers instead now?
         # Though .ORA files should probably still replace the entire
         # working file.
         uri = rawdata.split("\r\n")[0]
         file_path, _h = lib.glib.filename_from_uri(uri)
         if os.path.exists(file_path):
             ok_to_open = self.app.filehandler.confirm_destructive_action(
                 title=C_(
                     u'Open dragged file confirm dialog: title',
                     u"Open Dragged File?",
                 ),
                 confirm=C_(
                     u'Open dragged file confirm dialog: continue button',
                     u"_Open",
                 ),
             )
             if ok_to_open:
                 self.app.filehandler.open_file(file_path)
     elif info == 2:  # color
         color = uicolor.from_drag_data(rawdata)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)
示例#2
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
         # Perhaps these should be handled as layers instead now?
         # Though .ORA files should probably still replace the entire
         # working file.
         uri = rawdata.split("\r\n")[0]
         file_path, _h = lib.glib.filename_from_uri(uri)
         if os.path.exists(file_path):
             ok_to_open = self.app.filehandler.confirm_destructive_action(
                 title = C_(
                     u'Open dragged file confirm dialog: title',
                     u"Open Dragged File?",
                 ),
                 confirm = C_(
                     u'Open dragged file confirm dialog: continue button',
                     u"_Open",
                 ),
             )
             if ok_to_open:
                 self.app.filehandler.open_file(file_path)
     elif info == 2:  # color
         color = uicolor.from_drag_data(rawdata)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)
示例#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 = fileutils.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 = uicolor.from_drag_data(rawdata)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)
示例#4
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, _h = lib.glib.filename_from_uri(uri)
         if os.path.exists(fn):
             if self.app.filehandler.confirm_destructive_action():
                 self.app.filehandler.open_file(fn)
     elif info == 2:  # color
         color = uicolor.from_drag_data(rawdata)
         self.app.brush_color_manager.set_color(color)
         self.app.brush_color_manager.push_history(color)