changeset 2369:4a385c26402f

rm some unused 3rdparty code
author drewp@bigasterisk.com
date Mon, 05 Jun 2023 17:36:19 -0700
parents 8784bdc90648
children 18245a3a0f04
files lib/goocanvas_compat.py lib/qt4reactor.py tkdnd-patch-on-r95
diffstat 3 files changed, 0 insertions(+), 391 deletions(-) [+]
line wrap: on
line diff
--- a/lib/goocanvas_compat.py	Mon Jun 05 17:35:46 2023 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-from gi.repository import GooCanvas
-
-def Points(pts):
-    cp = GooCanvas.CanvasPoints.new(len(pts))
-    for i, (x, y) in enumerate(pts):
-        cp.set_point(i, x, y)
-    return cp
-
-def polyline_new_line(parent, x0=None, y0=None, x1=None, y1=None, points=None, **props):
-    p = GooCanvas.CanvasPolyline()
-    p.set_property('parent', parent)
-    if x0 is not None or points is not None:
-        pts = points or Points([(x0, y0), (x1, y1)])
-        p.set_property('points', pts)
-    for k, v in props.items():
-        p.set_property(k, v)
-    return p
--- a/lib/qt4reactor.py	Mon Jun 05 17:35:46 2023 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,213 +0,0 @@
-# http://twistedmatrix.com/trac/browser/sandbox/therve/qt4reactor.py
-# with some fixes by drewp
-
-# Copyright (c) 2001-2008 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-
-"""
-This module provides support for Twisted to interact with the PyQt mainloop.
-
-In order to use this support, simply do the following::
-
-    |  import qt4reactor
-    |  qt4reactor.install()
-
-Then use twisted.internet APIs as usual.  The other methods here are not
-intended to be called directly.
-
-API Stability: stable
-
-Maintainer: U{Itamar Shtull-Trauring<mailto:twisted@itamarst.org>}
-Port to QT4: U{Gabe Rudy<mailto:rudy@goldenhelix.com>}
-"""
-
-__all__ = ['install']
-
-
-import sys
-
-from zope.interface import implements
-
-from PyQt4.QtCore import QSocketNotifier, QObject, SIGNAL, QTimer
-from PyQt4.QtGui import QApplication
-
-from twisted.internet.interfaces import IReactorFDSet
-from twisted.python import log
-from twisted.internet.posixbase import PosixReactorBase
-
-
-
-class TwistedSocketNotifier(QSocketNotifier):
-    """
-    Connection between an fd event and reader/writer callbacks.
-    """
-
-    def __init__(self, reactor, watcher, type):
-        QSocketNotifier.__init__(self, watcher.fileno(), type)
-        self.reactor = reactor
-        self.watcher = watcher
-        self.fn = None
-        if type == QSocketNotifier.Read:
-            self.fn = self.read
-        elif type == QSocketNotifier.Write:
-            self.fn = self.write
-        QObject.connect(self, SIGNAL("activated(int)"), self.fn)
-
-
-    def shutdown(self):
-        QObject.disconnect(self, SIGNAL("activated(int)"), self.fn)
-        self.setEnabled(0)
-        self.fn = self.watcher = None
-
-
-    def read(self, sock):
-        w = self.watcher
-        def _read():
-            why = None
-            try:
-                why = w.doRead()
-            except:
-                log.err()
-                why = sys.exc_info()[1]
-            if why:
-                self.reactor._disconnectSelectable(w, why, True)
-        log.callWithLogger(w, _read)
-        self.reactor.simulate()
-
-
-    def write(self, sock):
-        w = self.watcher
-        def _write():
-            why = None
-            self.setEnabled(0)
-            try:
-                why = w.doWrite()
-            except:
-                log.err()
-                why = sys.exc_info()[1]
-            if why:
-                self.reactor._disconnectSelectable(w, why, False)
-            elif self.watcher:
-                self.setEnabled(1)
-        log.callWithLogger(w, _write)
-        self.reactor.simulate()
-
-
-
-class QTReactor(PosixReactorBase):
-    """
-    Qt based reactor.
-    """
-    implements(IReactorFDSet)
-
-    # Reference to a DelayedCall for self.crash() when the reactor is
-    # entered through .iterate()
-    _crashCall = None
-
-    _timer = None
-
-    def __init__(self, app=None):
-        self._reads = {}
-        self._writes = {}
-        if app is None:
-            app = QApplication([])
-        self.qApp = app
-        PosixReactorBase.__init__(self)
-        self.addSystemEventTrigger('after', 'shutdown', self.cleanup)
-            
-
-
-    def addReader(self, reader):
-        if not reader in self._reads:
-            self._reads[reader] = TwistedSocketNotifier(self, reader,
-                                                       QSocketNotifier.Read)
-
-
-    def addWriter(self, writer):
-        if not writer in self._writes:
-            self._writes[writer] = TwistedSocketNotifier(self, writer,
-                                                        QSocketNotifier.Write)
-
-
-    def removeReader(self, reader):
-        if reader in self._reads:
-            self._reads[reader].shutdown()
-            del self._reads[reader]
-
-
-    def removeWriter(self, writer):
-        if writer in self._writes:
-            self._writes[writer].shutdown()
-            del self._writes[writer]
-
-
-    def removeAll(self):
-        return self._removeAll(self._reads, self._writes)
-
-
-    def getReaders(self):
-        return self._reads.keys()
-
-
-    def getWriters(self):
-        return self._writes.keys()
-
-
-    def simulate(self):
-        self._lastTimer = self._timer # put off the __del__
-        if self._timer is not None:
-            self._timer.stop()
-            self._timer = None
-
-        if not self.running:
-            self.qApp.exit()
-            return
-        self.runUntilCurrent()
-
-        if self._crashCall is not None:
-            self._crashCall.reset(0)
-
-        timeout = self.timeout()
-        if timeout is None:
-            timeout = 1.0
-        timeout = min(timeout, 0.01) * 1010
-
-        if self._timer is None:
-            self._timer = QTimer()
-            self._timer.setObjectName("simulateTimer")
-            QObject.connect(self._timer, SIGNAL("timeout()"), self.simulate)
-        self._timer.start(timeout)
-
-    def cleanup(self):
-        if self._timer is not None:
-            self._timer.stop()
-            self._timer = None
-
-
-    def iterate(self, delay=0.0):
-        self._crashCall = self.callLater(delay, self._crash)
-        self.run()
-
-
-    def mainLoop(self):
-        self.simulate()
-        self.qApp.exec_()
-
-
-    def _crash(self):
-        if self._crashCall is not None:
-            if self._crashCall.active():
-                self._crashCall.cancel()
-            self._crashCall = None
-        self.running = False
-
-
-
-def install(app=None):
-    """
-    Configure the twisted mainloop to be run inside the qt mainloop.
-    """
-    from twisted.internet import main
-    reactor = QTReactor(app=app)
-    main.installReactor(reactor)
--- a/tkdnd-patch-on-r95	Mon Jun 05 17:35:46 2023 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,161 +0,0 @@
-Index: unix/TkDND_XDND.c
-===================================================================
---- unix/TkDND_XDND.c	(revision 95)
-+++ unix/TkDND_XDND.c	(working copy)
-@@ -517,7 +517,7 @@
-     ActionCopy, ActionMove, ActionLink, ActionAsk, ActionPrivate,
-     refuse_drop, ActionDefault
-   };
--    
-+  printf("TkDND_HandleXdndDrop\n");
-   if (interp == NULL) return False;
-   if (XDND_DROP_TIME(xevent) != 0) {
-     time = ((sizeof(Time) == 8 && XDND_DROP_TIME(xevent) < 0)
-Index: CMakeLists.txt
-===================================================================
---- CMakeLists.txt	(revision 95)
-+++ CMakeLists.txt	(working copy)
-@@ -168,7 +168,7 @@
- ADD_DEFINITIONS   ( -DTKDND_VERSION="${PKG_VERSION}" )
- 
- ## Package debug definitions...
--# ADD_DEFINITIONS   ( -DDEBUG_CLIENTMESSAGE_HANDLER )
-+ADD_DEFINITIONS   ( -DDEBUG_CLIENTMESSAGE_HANDLER )
- 
- ## ===========================================================================
- ##  Declare the package shared library target...
-Index: library/tkdnd_unix.tcl
-===================================================================
---- library/tkdnd_unix.tcl	(revision 95)
-+++ library/tkdnd_unix.tcl	(working copy)
-@@ -54,7 +54,7 @@
-   variable _last_mouse_root_y 0
- 
-   proc debug {msg} {
--    puts $msg
-+    #puts $msg
-   };# debug
- };# namespace xdnd
- 
-@@ -69,6 +69,7 @@
-   variable _common_drop_target_types; set _common_drop_target_types {}
-   variable _actionlist
-   variable _drag_source;              set _drag_source $drag_source
-+debug "_drop_target clear1"
-   variable _drop_target;              set _drop_target {}
-   variable _actionlist;               set _actionlist  \
-                                            {copy move link ask private}
-@@ -82,6 +83,15 @@
-   return default
- };# xdnd::_HandleXdndEnter
- 
-+
-+proc xdnd::_pointWithinWindow {win rootX rootY} {
-+  set x [winfo rootx $win]
-+  set y [winfo rooty $win]
-+  set w [winfo width $win]
-+  set h [winfo height $win]
-+  return [expr "$rootX >= $x && $rootX < $x+$w && $rootY >= $y && $rootY < $y+$h"]
-+}
-+
- # ----------------------------------------------------------------------------
- #  Command xdnd::_HandleXdndPosition
- # ----------------------------------------------------------------------------
-@@ -102,9 +112,19 @@
-   # debug "xdnd::_HandleXdndPosition: drop_target=$drop_target,\
-   #            _drop_target=$_drop_target, rootX=$rootX, rootY=$rootY"
- 
-+  # drop_target may be a parent of the real target.
-+
-+  # this is all a workaround for 'winfo containing' never returning anything
-+  set children [winfo children $drop_target]
-+  foreach child $children {
-+    if {[_pointWithinWindow $child $rootX $rootY]} {
-+      return [_HandleXdndPosition $child $rootX $rootY $drag_source]
-+    }
-+  }
-+    
-   if {![info exists _drag_source] && ![string length $_drag_source]} {
--    # debug "xdnd::_HandleXdndPosition: no or empty _drag_source:\
--    #               return refuse_drop"
-+    debug "xdnd::_HandleXdndPosition: no or empty _drag_source:\
-+                   return refuse_drop"
-     return refuse_drop
-   }
- 
-@@ -116,7 +136,7 @@
- 
-   ## Does the new drop target support any of our new types? 
-   set _types [bind $drop_target <<DropTargetTypes>>]
--  # debug ">> Accepted types: $drop_target $_types"
-+  debug ">> Accepted types: $drop_target $_types"
-   if {[llength $_types]} {
-     ## Examine the drop target types, to find at least one match with the drag
-     ## source types...
-@@ -130,7 +150,7 @@
-     }
-   }
-   
--  # debug "\t($_drop_target) -> ($drop_target)"
-+  debug "\t($_drop_target) -> ($drop_target)"
-   if {$drop_target != $_drop_target} {
-     if {[string length $_drop_target]} {
-       ## Call the <<DropLeave>> event.
-@@ -152,6 +172,7 @@
-         uplevel \#0 $cmd
-       }
-     }
-+    debug "_drop_target clear2"
-     set _drop_target {}
- 
-     if {[info exists common_drag_source_types]} {
-@@ -179,15 +200,16 @@
-         set _action [uplevel \#0 $cmd]
-       }
-     }
-+    debug "_drop_target set3 $drop_target"
-     set _drop_target $drop_target
-   }
-   
-   set _action refuse_drop
--  set _drop_target {}
-   if {[info exists common_drag_source_types]} {
-     set _action copy
-     set _common_drag_source_types $common_drag_source_types
-     set _common_drop_target_types $common_drop_target_types
-+    debug "_drop_target set5 -> $_drop_target"
-     set _drop_target $drop_target
-     ## Drop target supports at least one type. Send a <<DropPosition>>.
-     set cmd [bind $drop_target <<DropPosition>>]
-@@ -206,6 +228,10 @@
-         ] $cmd]
-       set _action [uplevel \#0 $cmd]
-     }
-+  } else {
-+    # logic wasn't clear; i'm just guessing this should be the else-clause
-+    debug "_drop_target clear4, was $_drop_target"
-+    set _drop_target {}
-   }
-   # Return values: copy, move, link, ask, private, refuse_drop, default
-   # debug "xdnd::_HandleXdndPosition: ACTION: $_action"
-@@ -227,7 +253,10 @@
-   variable _drop_target
-   variable _last_mouse_root_x
-   variable _last_mouse_root_y
--  if {![info exists _drop_target]} {set _drop_target {}}
-+  if {![info exists _drop_target]} {
-+debug "_drop_target clear6"
-+set _drop_target {}
-+}
-   # debug "xdnd::_HandleXdndLeave: _drop_target=$_drop_target"
-   if {[info exists _drop_target] && [string length $_drop_target]} {
-     set cmd [bind $_drop_target <<DropLeave>>]
-@@ -273,7 +302,7 @@
-   set rootX $_last_mouse_root_x
-   set rootY $_last_mouse_root_y
- 
--  # puts "xdnd::_HandleXdndDrop: $time"
-+  puts "xdnd::_HandleXdndDrop: $time $_drop_target"
- 
-   if {![info exists _drag_source] && ![string length $_drag_source]} {
-     return refuse_drop