develop #1
|
@ -6,12 +6,12 @@ import sys
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from utils.db import DB
|
from libs.db import DB
|
||||||
from utils.event_system import EventSystem
|
from libs.event_system import EventSystem
|
||||||
from utils.endpoint_registry import EndpointRegistry
|
from libs.endpoint_registry import EndpointRegistry
|
||||||
from utils.keybindings import Keybindings
|
from libs.keybindings import Keybindings
|
||||||
from utils.logger import Logger
|
from libs.logger import Logger
|
||||||
from utils.settings_manager.manager import SettingsManager
|
from libs.settings_manager.manager import SettingsManager
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import os
|
||||||
# Lib imports
|
# Lib imports
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from utils.debugging import debug_signal_handler
|
from libs.debugging import debug_signal_handler
|
||||||
from utils.ipc_server import IPCServer
|
from libs.ipc_server import IPCServer
|
||||||
from core.window import Window
|
from core.window import Window
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,17 +15,18 @@ from gi.repository import Gio
|
||||||
class DnDMixin:
|
class DnDMixin:
|
||||||
|
|
||||||
def _setup_dnd(self):
|
def _setup_dnd(self):
|
||||||
# flags = Gtk.DestDefaults.ALL
|
flags = Gtk.DestDefaults.ALL
|
||||||
|
|
||||||
PLAIN_TEXT_TARGET_TYPE = 70
|
PLAIN_TEXT_TARGET_TYPE = 70
|
||||||
URI_TARGET_TYPE = 80
|
URI_TARGET_TYPE = 80
|
||||||
|
|
||||||
text_target = Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags(0), PLAIN_TEXT_TARGET_TYPE)
|
text_target = Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags(0), PLAIN_TEXT_TARGET_TYPE)
|
||||||
uri_target = Gtk.TargetEntry.new('text/uri-list', Gtk.TargetFlags(0), URI_TARGET_TYPE)
|
uri_target = Gtk.TargetEntry.new('text/uri-list', Gtk.TargetFlags(0), URI_TARGET_TYPE)
|
||||||
|
|
||||||
targets = [ text_target, uri_target ]
|
# targets = [ text_target, uri_target ]
|
||||||
|
targets = [ uri_target ]
|
||||||
|
|
||||||
# action = Gdk.DragAction.COPY
|
action = Gdk.DragAction.COPY
|
||||||
|
|
||||||
self.drag_dest_set_target_list(targets)
|
self.drag_dest_set_target_list(targets)
|
||||||
# self.drag_dest_set(flags, targets, action)
|
# self.drag_dest_set(flags, targets, action)
|
||||||
|
@ -40,11 +41,12 @@ class DnDMixin:
|
||||||
def _on_drag_motion(self, widget, drag_context, x, y, time):
|
def _on_drag_motion(self, widget, drag_context, x, y, time):
|
||||||
Gdk.drag_status(drag_context, drag_context.get_actions(), time)
|
Gdk.drag_status(drag_context, drag_context.get_actions(), time)
|
||||||
|
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def _on_drag_set(self, widget, drag_context, data, info, time):
|
def _on_drag_set(self, widget, drag_context, data, info, time):
|
||||||
self.drag_get_data(drag_context, drag_context.list_targets()[-1], time)
|
self.drag_get_data(drag_context, drag_context.list_targets()[-1], time)
|
||||||
return True
|
|
||||||
|
return False
|
||||||
|
|
||||||
def _on_drag_data_received(self, widget, drag_context, x, y, data, info, time):
|
def _on_drag_data_received(self, widget, drag_context, x, y, data, info, time):
|
||||||
if info == 70: return
|
if info == 70: return
|
||||||
|
@ -66,5 +68,3 @@ class DnDMixin:
|
||||||
files.append(gfile)
|
files.append(gfile)
|
||||||
|
|
||||||
event_system.emit('set_pre_drop_dnd', (files,))
|
event_system.emit('set_pre_drop_dnd', (files,))
|
||||||
drag_context.finish(True, False, time)
|
|
||||||
|
|
Loading…
Reference in New Issue