ANN: asciimatics v1.7.0

2016-09-24 Thread Peter Brittain
I am very pleased to announce asciimatics v1.7.0!  This is a major update
since the last announced version of the package.



## What is asciimatics?


Asciimatics is a package to help people create full-screen text UIs (from
interactive forms to complex text animations) on Linux, Windows and OSX. It
supports python 2 & 3 and is licensed under the Apache Software Foundation
License 2.0.



## What’s new?


This release includes a `widgets` sub-package to create text User
Interfaces, complete with the standard basic set of widgets you would
expect for creating forms – e.g. text boxes, check boxes, buttons, etc.


Despite its name, asciimatics now fully supports Unicode in utf-8
environments, allowing for non-ASCII input from the keyboard and output to
the screen.  This is extended to the widgets, so you can use them for
languages other than English.


A new Plasma renderer was added, continuing the theme of retro special
effects.  This one can be used to create lava-lamp style animated
backgrounds.  See the new plasma.py sample for an example of how to use it.


A `highlight()` method was added to the Screen to allow you to colour wash
parts of the screen as if you were using a highlighter pen.  This can be
used to highlight or lowlight parts of the screen.  For an example, have a
look at the shadows on a Frame in the forms.py sample.


A complete suite of unit tests and CI builds have been created, to ensure
that the code continues to run across all supported environments.  Latest
results are always available at the project home page.


Various other minor enhancements and fixes have gone in.  For a complete
list have a look at the change log:

https://raw.githubusercontent.com/peterbrittain/asciimatics/
master/CHANGES.rst




## Where can I find out more?


https://github.com/peterbrittain/asciimatics
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python TUI that will work on DOS/Windows and Unix/Linux

2016-04-24 Thread Peter Brittain
I noticed this trail on Google...  if you're still interested, you could try out

https://github.com/peterbrittain/asciimatics

I ported it to Windows from Linux so exactly the same API works on both.
-- 
https://mail.python.org/mailman/listinfo/python-list


A high-level cross-platform API for terminal/console access

2015-10-21 Thread Peter Brittain
I have recently been working on a terminal/console animation package 
(https://github.com/peterbrittain/asciimatics). Beyond the high-level animation 
methods/objects it provides, it also needed to be cross-platform and and simple 
to install with pip (including any dependencies).

This cross-platform requirement meant I needed a curses equivalent for Windows. 
 This appears to have been a regular issue over the years and I've looked 
around at previous answers on the web and this newsgroup.  Now while there's 
some pretty neat stuff out there, nothing actually gave me everything I needed.

1) colorama only gives you colours and cursor positioning, but no input, 
resizing or screen-scraping options.

2) blessings/blessed provide better (but incomplete) APIs than the curses 
package, but no Windows support unless you use colorama (which is still limited 
as above).

3) console (from effbot.org) is a native installer and so fails the pip test.  
It does however show direct use of the win32 API is a tenable approach.

4) The other packages I found were either dead projects or relied on a native 
installation of an open source implementation of curses - with no pip install 
option available.

I therefore started writing a consistent wrapper API (the Screen object) that 
uses the curses package on Unix variants and pywin32 to access the Windows 
console API.  

Over the last few months I've rounded out the features and proved that 
asciimatics works identically on Linux (various distros), OSX and Windows 7-10. 
  I know that there are still some rough edges due to the history of the 
project and so I've been deprecating old APIs in preparation for creating a 
completely clean API when I create the next major (v2.x) release.

I suspect that it could be even better though, so am looking for feedback and 
ideas from the community - both on the high-level animation features and the 
low-level cross-platform terminal API.  

Is there something you can see that could be usefully improved?  All feedback 
welcome.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-21 Thread Peter Brittain
> 
> Did you try https://pypi.python.org/pypi/UniCurses ?
> 

Yes - it failed to install with pip and also looked like a dead project when I 
followed the project home page URL.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Peter Brittain
On Wednesday, October 21, 2015 at 11:26:40 PM UTC+1, eryksun wrote:
> 
> Also check out the curses module that's available on Christoph Gohlke's site:
> 
> http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses

Neat.  I wasn't aware of this library of wheel installations.  I'll have a look 
at how that works out and see if I can rationalize my mapping code.  

First impression is that this might be tricky, though, as I've had issues with 
older Linux distributions using ncurses 5 and so handling 256 colour modes has 
been difficult due to limits on colour pairs.  This meant I had to fall back to 
looking up and using codes in the terminfo database using tigetstr.  According 
to the PDcurses docs, these APIs are all just stubs that return an error and so 
I'll probably need a curses and PDcurses mapping layer from the looks of things 
- which is not much better than a curses and win32 mapping layer.

I'm also still not convinced that curses package is the right API to expose for 
Python.  While ncurses does a great job of abstracting away the issues of 
terminal inter-operation, the Python curses package is just a thin wrapper of 
that C library and, as can be seen above, not truly cross-platform due to the 
restrictions of PDcurses.

Shouldn't we have a higher level simplification?  Something that hides away all 
the complexity of handling all these different platforms and so exposes a 
simple API?  One that humans can use without worrying about these issues?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Peter Brittain
On Thursday, October 22, 2015 at 10:24:11 AM UTC+1, Laura Creighton wrote:
> Fredrik Lundh's console implementation
> http://effbot.org/zone/console-handbook.htm
> might be of interest in that case, but I think it is 'old versions
> of windows only'.  But it's a different take on the abstraction 
> problem.  I haven't used it for something like 15 years now, though,
> so can barely remember it ...

Thanks, but I think this is already covered in my original post: I couldn't use 
it directly due to the pip installation restriction.  I've now created a 
working Windows implementation, so I don't need another mapping for win32.

More generally, as these posts begin to show, there was no _simple_ way for me 
to get a cross-platform console API that "just worked" out of the box.  I've 
had to jump through various hoops to get to where I am and don't think that 
other people should have to go through the same pain as I have.  

This is one of the reasons why I've been tidying up my package to make this as 
simple as possible for the next person.  I've now got to the stage where I have 
something that works for me, but it is almost certainly missing something.  
Maybe it's not good enough documentation, maybe there's some clunkiness left in 
the API due to the history of the project, maybe there's an even better way to 
represent terminals than what I've come up with so far?

I was hoping for feedback on this front rather than other ways I could recreate 
the curses package - unless of course, the general consensus is that this 
really is the way that Python should expose access to the terminal/console.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: A high-level cross-platform API for terminal/console access

2015-10-22 Thread Peter Brittain
On Thursday, October 22, 2015 at 12:25:09 PM UTC+1, Gisle Vanem wrote:
> I tried installing your package with "pip.exe -v install asciimatics".
> Some problem with pypiwin32 it seems:
> 
> Installing collected packages: pypiwin32, future, Pillow, pyfiglet, 
> asciimatics
> 
>   Cleaning up...
>   Exception:
>   Traceback (most recent call last):
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\basecommand.py",
>  line 232, in main
>   status = self.run(options, args)
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\commands\install.py",
>  line 347, in run
>   root=options.root_path,
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_set.py",
>  line 549, in install
>   **kwargs
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_install.py",
>  line 751, in install
>   self.move_wheel_files(self.source_dir, root=root)
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\req\req_install.py",
>  line 960, in move_wheel_files
>   isolated=self.isolated,
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\wheel.py",
>  line 234, in move_wheel_files
>   clobber(source, lib_dir, True)
> File 
> "g:\Programfiler\Python27\lib\site-packages\pip-6.0.6-py2.7.egg\pip\wheel.py",
>  line 212, in clobber
>   shutil.copyfile(srcfile, destfile)
> File "g:\Programfiler\Python27\lib\shutil.py", line 83, in copyfile
>   with open(dst, 'wb') as fdst:
>   IOError: [Errno 13] Permission denied: 
> 'g:\\Programfiler\\Python27\\Lib\\site-packages\\win32\\win32api.pyd'
> 
> -
> 
> BTW, this is on Python 2.7.9 on Win-XP SP3.
> 
> --gv

That's a new one on me.  The pypiwin32 package has installed fine for me on 
Python 3 in  Windows 7, 8 and 10.  Sadly I don't have ready access to an XP 
machine, so can't easily try a repro myself...  Does the file already exist, or 
are you lacking permissions to update the folder?
-- 
https://mail.python.org/mailman/listinfo/python-list