Re: [PyQt] win32api.LoadKeyboardLayout; any solutions for OSX?

2015-03-20 Thread Timothy W. Grove
Thanks again. Macports didn't have the latest pyobjc, but pip updated my 
installation to the fixed version. Problem solved.


Tim

On 20/03/2015 00:18, michael h wrote:

Did you see this:

https://bitbucket.org/ronaldoussoren/pyobjc/issue/95/attributeerror-in-some-cases-when-checking



On Thu, Mar 19, 2015 at 12:20 PM, Timothy W. Grove tim_gr...@sil.org 
mailto:tim_gr...@sil.org wrote:


A personal reply to my question sent me to the following link:

http://stackoverflow.com/questions/23729704/change-osx-keyboard-layoutinput-source-programmatically-via-terminal-or-appl.
I seem to have found a solution that worked using PyObjC.

I'm currently using Python 3.3 installed via macports, and I
installed the appropriate ports for my setup (py33-pyobjc,
py33-pyobjc-cocoa).

For my import statement:

from AppKit import NSTextInputContext

To find the current keyboard being used:

ic = NSTextInputContext.new()
current_keyboard = ic.selectedKeyboardInputSource()

To list the currently available keyboards:

keyboards = ic.keyboardInputSources()

To change the current keyboard (to 'Arabic', for example):

ic.setValue_forKey_('com.apple.keylayout.Arabic',
'selectedKeyboardInputSource')


Now, that is the good news! This all worked great in my source
code, but as an app bundle (created with cx_Freeze 4.3.2) it
wouldn't run at all. I'll include the full error trace at the end
of this email, but the problems seem to start with the import of
AppKit and end with objc/_lazyimport.py.

I'm not sure if this points to a 'bug' in objc or something else
which I've left out of my setup routine, but if anyone has any
ideas, I would be interested to hear from you.

Best regards,
Timothy Grove



On 05/03/2015 14:51, Timothy W. Grove wrote:

I was looking for a way to change keyboard layouts from within a
Python 3 / PyQt4 application. Win32api.LoadKeyboardLayout has
come to my rescue on Windows, but is anyone aware of a
cross-platform or OSX specific solution for Apple Mac? Thanks for
any suggestions.

Best regards,
Tim


Traceback (most recent call last):

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/cx_Freeze/initscripts/Console3.py,
line 27, in module

exec(code, m.__dict__)

  File soosl.py, line 6, in module

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File
/Users/timothygrove/Documents/workspace/SooSL/mainwindow.py,
line 19, in module

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/AppKit/__init__.py,
line 9, in module

import Foundation

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Foundation/__init__.py,
line 9, in module

import CoreFoundation

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/CoreFoundation/__init__.py,
line 20, in module

}, ())

  File

/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site

Re: win32api.LoadKeyboardLayout; any solutions for OSX?

2015-03-19 Thread Timothy W. Grove
A personal reply to my question sent me to the following link: 
http://stackoverflow.com/questions/23729704/change-osx-keyboard-layoutinput-source-programmatically-via-terminal-or-appl. 
I seem to have found a solution that worked using PyObjC.


I'm currently using Python 3.3 installed via macports, and I installed 
the appropriate ports for my setup (py33-pyobjc, py33-pyobjc-cocoa).


For my import statement:

   from AppKit import NSTextInputContext

To find the current keyboard being used:

   ic = NSTextInputContext.new()
   current_keyboard = ic.selectedKeyboardInputSource()

To list the currently available keyboards:

   keyboards = ic.keyboardInputSources()

To change the current keyboard (to 'Arabic', for example):

   ic.setValue_forKey_('com.apple.keylayout.Arabic',
   'selectedKeyboardInputSource')


Now, that is the good news! This all worked great in my source code, but 
as an app bundle (created with cx_Freeze 4.3.2) it wouldn't run at all. 
I'll include the full error trace at the end of this email, but the 
problems seem to start with the import of AppKit and end with 
objc/_lazyimport.py.


I'm not sure if this points to a 'bug' in objc or something else which 
I've left out of my setup routine, but if anyone has any ideas, I would 
be interested to hear from you.


Best regards,
Timothy Grove



On 05/03/2015 14:51, Timothy W. Grove wrote:
I was looking for a way to change keyboard layouts from within a 
Python 3 / PyQt4 application. Win32api.LoadKeyboardLayout has come to 
my rescue on Windows, but is anyone aware of a cross-platform or OSX 
specific solution for Apple Mac? Thanks for any suggestions.


Best regards,
Tim


   Traceback (most recent call last):

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/cx_Freeze/initscripts/Console3.py,
   line 27, in module

exec(code, m.__dict__)

  File soosl.py, line 6, in module

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File
   /Users/timothygrove/Documents/workspace/SooSL/mainwindow.py, line
   19, in module

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/AppKit/__init__.py,
   line 9, in module

import Foundation

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/Foundation/__init__.py,
   line 9, in module

import CoreFoundation

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1565, in _find_and_load

return _find_and_load_unlocked(name, import_)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/importlib/_bootstrap.py,
   line 1532, in _find_and_load_unlocked

loader.load_module(name)

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/CoreFoundation/__init__.py,
   line 20, in module

}, ())

  File
   
/opt/local/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/objc/_lazyimport.py,
   line 82, in __init__

if nm.startswith(pfx):

   AttributeError: 'NoneType' object has no attribute 'startswith'

   logout


   [Process completed]


-- 
https://mail.python.org/mailman/listinfo/python-list


win32api.LoadKeyboardLayout; any solutions for OSX?

2015-03-05 Thread Timothy W. Grove
I was looking for a way to change keyboard layouts from within a Python 
3 / PyQt4 application. Win32api.LoadKeyboardLayout has come to my rescue 
on Windows, but is anyone aware of a cross-platform or OSX specific 
solution for Apple Mac? Thanks for any suggestions.


Best regards,
Tim
--
https://mail.python.org/mailman/listinfo/python-list


Re: include icudt53.dll, icuin53.dll, icuuc53.dll ?

2015-01-07 Thread Timothy W. Grove
I think my answer is probably Yes! Anyone else interested, see 
http://qt-project.org/wiki/Deploying-Windows-Applications.


Tim

On 07/01/2015 13:09, Timothy W. Grove wrote:
Does anyone have an idea of what the following .dll's are for? 
Cx_freeze includes them in a Python3.4-PyQt5 deployment adding about 
23 Mb to my application. Removing them doesn't appear to make any 
difference on my computer, but I hesitate to distribute the 
application to others without them. Thanks for any response.


Best regards,
Tim Grove

icudt53.dll
icuin53.dll
icuuc53.dll


--
https://mail.python.org/mailman/listinfo/python-list


include icudt53.dll, icuin53.dll, icuuc53.dll ?

2015-01-07 Thread Timothy W. Grove
Does anyone have an idea of what the following .dll's are for? Cx_freeze 
includes them in a Python3.4-PyQt5 deployment adding about 23 Mb to my 
application. Removing them doesn't appear to make any difference on my 
computer, but I hesitate to distribute the application to others without 
them. Thanks for any response.


Best regards,
Tim Grove

icudt53.dll
icuin53.dll
icuuc53.dll
--
https://mail.python.org/mailman/listinfo/python-list


Automatic Crash Reporting

2014-09-24 Thread Timothy W. Grove
Can anyone recommend a good automatic crash reporting module that would 
work nicely with a python3/pyqt4 application? Thanks.


Tim
--
https://mail.python.org/mailman/listinfo/python-list


An example of Python in action!

2014-02-25 Thread Timothy W. Grove
Here is an example of Python being used with Maya for animation  
http://vimeo.com/72276442


(No prizes for guessing what sport and team I support!!!)

Best regards,
Tim Grove
--
https://mail.python.org/mailman/listinfo/python-list


Re: An example of Python in action!

2014-02-25 Thread Timothy W. Grove
I'm sorry, but I don't know much more than this. If you follow the link 
there is a description of how the animation was created under the video.


On 25/02/2014 18:47, Skip Montanaro wrote:

On Tue, Feb 25, 2014 at 12:07 PM, Timothy W. Grove tim_gr...@sil.org wrote:

Here is an example of Python being used with Maya for animation 
http://vimeo.com/72276442

Maya as in MayaVi, the 3D data visualizer built atop VTK?

Skip



--
https://mail.python.org/mailman/listinfo/python-list


Securing files

2011-02-23 Thread Timothy W. Grove

Hello Folks,

In a python application that I'm developing I've been asked to add 
security to databases that the program might create and access; the 
database is to be password protected by its creator. The application 
uses an SQLite database, which could be changed for another back-end if 
that would offer better security, but I would still like to use an 
embeddable database file.


The problem isn't so much the database itself, as I can think of a 
number of way to encrypt the data it contains, but some of the data is 
simply names of image and video files contained elsewhere in the 
file-system. Is there anyway to prevent a user from simply opening up 
the file-system from outside of the application and viewing the files? 
One way that I can think of would be to encode the image/video files as 
BLOBS and store them in the database itself, but apart from that option, 
can anyone suggest other ways? I'm currently working with python2.7 
under Windows7, but I'm hoping to extend the application to Linux and 
Mac also. Thank you for your help.


Best regards,
Tim
--
http://mail.python.org/mailman/listinfo/python-list


subprocess module under python 2.7

2010-07-27 Thread Timothy W. Grove
I am using the following code to hide the console window when launching 
a subprocess under Windows.


   startupinfo = subprocess.STARTUPINFO()
   startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
   startupinfo.wShowWindow = subprocess.SW_HIDE

   self.mplayer = Popen(args,
bufsize=0, #unbufferred
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
close_fds=False,
universal_newlines=True,
startupinfo=startupinfo
)

This worked okay in using the subprocess module under python 2.6, but 
under python 2.7 I get the error:


Exception in thread Thread-1:
Traceback (most recent call last):
 File threading.pyo, line 530, in __bootstrap_inner
 File gui\mplayer_ctrl.pyo, line 93, in run
AttributeError: 'module' object has no attribute 'STARTF_USESHOWWINDOW'

Anything changed between python versions to account for this?

Best regards,
Tim




--
http://mail.python.org/mailman/listinfo/python-list


Python User Group near Cheltenham, UK ?

2010-02-08 Thread Timothy W. Grove
Anyone know of an 'active' Python User Group near Cheltenham, UK? I 
spotted one in Birmingham (http://www.pywm.eu), but would like one a 
little closer ... :-)


Tim
--
http://mail.python.org/mailman/listinfo/python-list


Python and lost files

2009-10-01 Thread Timothy W. Grove
Recently I purchased some software to recover some files which I had 
lost. (A python project, incidentally! Yes, I should have kept better 
backups!) They were nowhere to found in the file system, nor in the 
recycle bin, but this software was able to locate them and restore them. 
I was just wondering if there was a way using python to view and recover 
files from the hard drive which would otherwise remain lost forever?


Best regards,
Tim
--
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Distutils - can user designate install directory for windows installer?

2009-09-09 Thread Timothy W. Grove



Mark Hammond wrote:
div class=moz-text-flowed style=font-family: -moz-fixedOn 
9/09/2009 1:57 AM, Timothy W. Grove wrote:

I have successfully built a windows installer for my python program
using distutils, (python setup.py bdist_wininst), but is there a way to
do it that will allow a user ('user' == 'boss', in this case!) to
designate the installation directory, rather than being forced to
install into /Python/Lib/site-packages ? Thanks for any help.


bdist_wininst is for packaging python modules or packages and so 
depends on Python itself being installed.  As a result, it only 
installs into where Python libs and modules are generally installed.


It sounds like you are looking for something to create a stand-alone 
version of your program - in that case you are probably looking for 
py2exe to create the application itself, and something like Inno or 
NSYS to create an installer which allows the user to specify where 
they want it installed and doesn't depend on Python already being 
installed.


Cheers,

Mark
Your advice sounds like the direction I may have to go. It was just that 
when I run the distutils installer, I'm presented with a setup dialog 
which shows the install directory  as /Python26 /site-packages/ in an 
uneditable text field. I thought that there might be an easy way to make 
that editable in order to change the path to a user defined directory, 
although I might also want to drop a .pth file into the site-packages 
directory so python knows where the application really is installed.


Thanks for your advice.

Best regards,
Tim


/div


--
http://mail.python.org/mailman/listinfo/python-list


Distutils - can user designate install directory for windows installer?

2009-09-08 Thread Timothy W. Grove
I have successfully built a windows installer for my python program 
using distutils, (python setup.py bdist_wininst), but is there a way to 
do it that will allow a user ('user' == 'boss', in this case!) to 
designate the installation directory, rather than being forced to 
install into /Python/Lib/site-packages ? Thanks for any help.


Best regards,
Tim Grove
--
http://mail.python.org/mailman/listinfo/python-list