1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

- Fixed focus handling for windows that set WM_HINTS.take_focus = False.

- Misc fixes.
- Improved a bit the python wrapper.
- Build po files before 'make install'
This commit is contained in:
dan
2002-12-20 17:47:31 +00:00
parent 55d37178a0
commit 064f79ebae
17 changed files with 225 additions and 203 deletions

View File

@@ -1,7 +1,7 @@
all: WINGs.c
python setup.py build
ln -s `find build/ -name wings.so` .
ln -sf `find build/ -name wings.so` .
install: WINGs.c
python setup.py install

View File

@@ -28,7 +28,7 @@
return NULL;
}
}
// This cleans up the char ** array we mallocd before the function call
// This cleans up the char ** array we malloc-ed before the function call
%typemap(python, freearg) char ** {
wfree($1);
}
@@ -95,7 +95,7 @@
$1 = PyFile_AsFile($input);
}
/* These are for freeing the return of functions that need to be freed
/* These are for free-ing the return of functions that need to be freed
* before returning control to python. */
%typemap(python, ret) char* WMGetTextFieldText { wfree($1); };
@@ -173,6 +173,7 @@
//%rename WMScreenMainLoop _WMScreenMainLoop;
//%rename(_WMScreenMainLoop) WMScreenMainLoop;
//%rename WMRunModalLoop _WMRunModalLoop;
@@ -529,14 +530,34 @@
%}
/* ignore structures we will not use */
%ignore ConnectionDelegate;
/* ignore functions we don't need */
// should we ignore vararg functions, or just convert them to functions with
// a fixed number of parameters?
%varargs(char*) wmessage;
//%ignore wmessage;
%ignore wwarning;
%ignore wfatal;
%ignore wsyserror;
%ignore wsyserrorwithcode;
%ignore WMCreatePLArray;
%ignore WMCreatePLDictionary;
%apply int *INPUT { int *argc };
#define Bool int
%include "WINGs/WUtil.h"
/* ignore structures we will not use */
/* ignore functions we don't need */
%include "WINGs/WINGs.h"
%{
void
WHandleEvents()
@@ -558,6 +579,7 @@ WHandleEvents()
}
%}
/* rewrite functions originally defined as macros */
%inline %{
#undef WMDuplicateArray

View File

@@ -2,23 +2,27 @@
import sys
import wings
import exceptions
from exceptions import Exception, StandardError
from types import *
# Some useful constants
False = 0
True = 1
# check about None as action for buttonAction/windowCloseAction ...
################################################################################
# Exceptions
################################################################################
class Error(exceptions.Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
__repr__ = __str__
class Error(StandardError):
pass
del Exception, StandardError
class WMTimer:
def __init__(self, milliseconds, callback, cdata=None, persistent=0):
def __init__(self, milliseconds, callback, cdata=None, persistent=False):
if persistent:
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
else:
@@ -30,15 +34,17 @@ class WMTimer:
class WMPersistentTimer(WMTimer):
def __init__(self, milliseconds, callback, cdata=None):
WMTimer.__init__(self, milliseconds, callback, cdata, persistent=1)
WMTimer.__init__(self, milliseconds, callback, cdata, persistent=True)
class WMScreen:
__readonly = ('display', 'width', 'height', 'depth')
def __init__(self, appname, display="", simpleapp=0):
def __init__(self, appname, display="", simpleapp=False):
wings.WMInitializeApplication(appname, len(sys.argv), sys.argv)
self._o = wings.pyWMOpenScreen(display, simpleapp)
if not self._o:
raise Error, "Cannot open display %s" % display
self.__dict__['display'] = wings.WMScreenDisplay(self._o)
self.__dict__['width'] = wings.WMScreenWidth(self._o)
self.__dict__['height'] = wings.WMScreenHeight(self._o)
@@ -69,7 +75,7 @@ class WMScreen:
class WMView:
pass
class WMWidget(WMView):
def __init__(self):
self._o = None
@@ -429,7 +435,7 @@ class WMTextField(WMWidget):
wings.WMSetTextFieldFont(self._o, font)
def font(self):
return wings.WMGettextFieldFont(self._o)
return wings.WMGetTextFieldFont(self._o)
################################################################################
@@ -509,7 +515,7 @@ if __name__ == "__main__":
win2.hide()
def dc(object, data, action):
print "didChnage:", object, data, action
print "didChange:", object, data, action
def dbe(object, data, action):
print "didBeginEditing:", object, data, action
@@ -520,7 +526,7 @@ if __name__ == "__main__":
object.setFocusTo(txt2)
else:
object.setFocusTo(txt)
print "didEndEditing:", object, data, action, txt.text()
print "didEndEditing:", object, data, action, object.text()
def tcb(one):
old = list.selectedItemRow()
@@ -625,7 +631,7 @@ if __name__ == "__main__":
timer = WMPersistentTimer(1000, tcb, win)
#del(timer)
#timer.delete()
win2 = WMPanel(win, "anotherWindow", WMTitledWindowMask)
win2.setTitle("transient test window")
win2.resize(150, 50)

View File

@@ -11,6 +11,7 @@ wings = os.popen("get-wings-flags --cflags", "r")
lines = [x.strip() for x in wings.readlines()]
flags = reduce(lambda x,y: x+y, [x.split() for x in lines if x])
include_dirs = [x[2:] for x in flags]
#include_dirs += [".."]
wings.close()
## Get the library dirs
@@ -18,6 +19,7 @@ wings = os.popen("get-wings-flags --ldflags", "r")
lines = [x.strip() for x in wings.readlines()]
flags = reduce(lambda x,y: x+y, [x.split() for x in lines if x])
library_dirs = [x[2:] for x in flags]
#library_dirs += [".."]
wings.close()
## Get the libraries

View File

@@ -24,7 +24,7 @@ if __name__ == "__main__":
win2.hide()
def dc(object, data, action):
print "didChnage:", object, data, action
print "didChange:", object, data, action
def dbe(object, data, action):
print "didBeginEditing:", object, data, action
@@ -35,7 +35,7 @@ if __name__ == "__main__":
object.setFocusTo(txt2)
else:
object.setFocusTo(txt)
print "didEndEditing:", object, data, action, txt.text()
print "didEndEditing:", object, data, action, object.text()
def tcb(one):
old = list.selectedItemRow()