ok100 | 15 Apr 2013 21:29
Gravatar

How to get position and total number of lines in ListBox?

Hello,

I have the following code:

http://bpaste.net/show/91579/

My question is, how to get the current scroll position and total number
of lines in the ui.listbox? I need this to implement scrolling to the
end of listbox (e.g with G key) and to display current position in the
statusbar (like in vim). Or is there some better way?

Thanks in advance
O
Rodrigo Bistolfi | 11 Apr 2013 22:57
Picon
Gravatar

'next selectable' and 'prev selectable'

Hi guys,

I noted that "tab" and "shift tab" were not working in our application. I looked a bit around and I found that if I map tab to "cursor down" it does work. My app has a wizard style, there are some controls in a list walker and then "next" and "previous" buttons in a single line. I would like to have the focus to jump from the last item in the list to the first button (all the way down) and then to the second button (one item to the right.) Instead of using the arrows, a user could use tab to cycle through selectable widgets. Thats why I thought "next selectable" and "prev selectable" would do.
Any hints about where to look at ?

Thanks in advance, Rodrigo
_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
David | 19 Feb 2013 18:51
Picon
Favicon

Using urwid with external event loop

I'm attempting to use urwid as a command-line server interface with the panda3d game engine. I've attempted to write a main and event loop that is run by the game engine's main loop but have failed to produce any results other than a blank screen. Does anyone have any suggestions on how to tackle this problem? Thank you for the help!.
 
-d-
_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
Ian Ward | 15 Feb 2013 17:56
Favicon
Gravatar

Re: mouse_event to keypress

On Fri, Feb 15, 2013 at 11:52 AM, Angel Kolev <meneldor <at> gmail.com> wrote:
> It would be very hard to post the whole code because its separated in many
> files/libs.
> I created a plugin-based framework and made it to open unlimited pop-ups. I
> made a main class Window which is responsible for all widgets in it. Window
> has a method add_row() so i am building whatever mixed widget i want.
> Example code for the menu from above:
>             window = self.new_window(21, 55, text="Choose User and Pass for
> each host (%s)" % len(hosts))
>             for item in hosts:
>                 window.add_row([ BaseInput(' User: ',value=item[1][0]),
> BaseInput(' Pass: ',value=item[1][1]) ],border=item[0])
>             window.add_buttons([ "Done"])
>             return window
> The result from the code above is in the attached screenshot.
> So, i want to use the mouse scroll to scroll the rows instead of the
> keyboard, but i cant convert the mouse_event to keypress up/down.

I see.

Maybe you want to convert all unhandled mouse wheel events into
up/down keystrokes?  That can be done in an unhandled_input callback
on your MainLoop that checks for the mouse event and calls
main_loop.process_input(['up']) or ...(['down'])

Ian
Angel Kolev | 15 Feb 2013 16:45
Picon

mouse_event to keypress

Hello group,


I have class which wraps EditBox. I want to initiate "Up" or "Down" key presses using the mouse event buttons 4 and 5 so when i scroll the mouse over the EditBox it should act the same way i am using the keyboard.
I tried this:

    def mouse_event(self,size,event,button,col,row,focus):
        if int(button)==5:            
            self.__super.keypress(size,"down")
        elif int(button)==4:
            self.__super.keypress(size,"up")
The goal i want to achieve is to scroll over ListBox items where every line is an EditBox. It works perfectly with up/down from the keyboard but cant using the method above.

Thanks!
_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
Ian Ward | 14 Feb 2013 18:39
Favicon
Gravatar

Re: Urwid

The web_display module is really a toy, and I must admit I haven't
even tried it in the most recent versions.

What were you planning on using it for?

On Thu, Feb 14, 2013 at 12:03 PM, Pablo M. Mana <pablo.m.mana <at> gmail.com> wrote:
> Hello Ian:
> I am a beginner in python trying to figure out how to use urwid and
> web_display. Is there somewhere on some working example?.
> Thanks in advance
> Pablo M. Mana
>
>
R J Cooper | 5 Feb 2013 19:34
Picon

Fwd: ScrollView, TabView, SplitView and a question

I've been playing around with urwid and I like it; it reminds me of the glory days of TurboVision.  Whilst
playing around I've created a simple TabView, SplitView and ScrollView and thought I'd share them in case
anyone else is interested.  They need some work; documentation, a bit of tidying up and the scrollview
needs to translate events when it passes them through to its content.

Have a look: https://github.com/mountainstorm/mt_urwid

in return I've got a question.  How do I enable SGR 1006 (in both my terminal and urwid).  I know my terminal
(iTerm2) supports SGR 1006, and I'm guessing I need to do "export TERM=xterm-1006" - I currently do
"export TERM=xterm-1003" ... but I get an error with 1006.  Should it work and if not, is there any other way I
can get mouse events for col/rows beyond 225ish?

Thanks

Rich
Jason But | 29 Jan 2013 00:26
Picon
Picon
Favicon

ListBox and focus problem

Hello all

I've been hacking away for the last three days with urwid, my program is 
visually organised as follows (with extra stuff but this is the most 
important bit)

---------------------------------------------------------------
|listbox widget  | terminal widget                            |
|                |                                            |
|                |                                            |
|                |                                            |
|                |                                            |
|                |                                            |
|                |                                            |
---------------------------------------------------------------

The terminal widget is tied to a callable which executes a series of 
external commands (using subprocess.call). The callable also sends progress 
information to the main program using a watch_pipe where a handler takes 
progress information to update the currently selected item in the listbox. A 
summary of the process is that the listbox displays a list of tasks to 
execute, which are executed in the terminal window, the selected item is the 
listbox is updated to indicate what the current task is.

The problem is this.

1) The program works fine ONLY if the applications executed in the terminal 
widget do NOT require any keyboard input.

2) The two widgets above are in a Columns, if O use a "cols.focus_col = 1" 
(giving focus to the terminal widget), then all of a sudden any applications 
that require keyboard input start working as the terminal is the selected 
widget. However, because the listbox has lost focus, the currently selected 
item is no longer highlighted

Any ideas on how I can achieve both?

Thanks in advance

Jason
Goffi | 17 Jan 2013 14:27

ANN: Salut à Toi v0.3 XMPP client with Urwid frontend

G'day,

I've released a new version of « Salut à Toi », a multi-frontends XMPP client, 
with features such as microblogging, games, file transfer, etc.

There is a frontend made with Urwid: Primitivus, and I have released a set of 
widgets for it, which I distribute in the library « urwid-satext » (available 
on pypi or on http://repos.goffi.org ).

In this release, Primitivus is now modal, à la vi. Future versions should 
bring commands like :split or :vsplit .

Everything is free software (libre). Any help welcome :)

announce: http://www.goffi.org/post/2013/01/11/Salut-%C3%A0-Toi-
version-0.3.0-%28with-demo-online-%21%29
official website: http://sat.goffi.org
blog: http://www.goffi.org
live demo of the web interface: http://www.libervia.org

Cheers
Goffi

PS: thanks to Ian for Urwid, the Urwid frontend is the one I use mainly.
Christopher Trudeau | 13 Jan 2013 16:15

simple overlay? (again?)

I apologize if this shows up twice, I didn't originally send it from the account I signed up with and I think the list manager ignored it.

----------
I'm trying to add a "help" dialog box to my application so have been fiddling with Overlay and PopUpLauncher, with little success with either.  With Overlay I've yet to be able to see an overlayed window, no exceptions, just does nothing.  With PopUpLauncher I've had similar problems, in certain configurations I've managed to see a window but not been able to get it to focus.  I've looked at the examples, but they all seem to be based on a simple underlying window with only a button, as soon as I try to do something more complicated I get stuck.

Below is a simple version of what I'm trying to accomplish that is structured in a similar vein to the larger program.  Any hints on what I'm doing wrong would be greatly appreciated.  This version shows nothing at all, debug statements confirm things are getting run and constructed (not shown below) but nothing is shown. 

def key_handler(key):
    if key in ('q', 'Q'):
        raise urwid.ExitMainLoop()
    elif key in ('o', 'O'):
        show_overlay();


def show_overlay():
    text = urwid.Text(POPUP_TEXT)
    pile = urwid.Pile([text, ])
    urwid.Overlay(pile, outer, 'center', 50, 'middle', 50)


header = urwid.Text(('header', 'q=quit; o=overlay'))
roach = urwid.Text(ROACH)
fill = urwid.Filler(roach, 'top')
outer = urwid.Frame(fill, header=header)
loop = urwid.MainLoop(outer, palette, 
    unhandled_input=key_handler, pop_ups=True)
loop.run()


Thanks for your help.

--
Christopher Trudeau
ctrudeau <at> arSensa.com
(cell) 416-731-4304

_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
seanh | 2 Jan 2013 04:19
Picon
Gravatar

ANN: Terminal Velocity (Urwid notes app)

Hey all, just wanted to let you know about my app:

http://seanh.github.com/terminal_velocity

It's a Notational Velocity (OS X note-taking app) clone in Urwid. I just
released version 0.1 alpha, it has all the core features that I wanted
but hasn't had much testing, my plan is to use it for my own note-taking
at work for a while and see what bugs etc. come up before I do an 0.1
stable release.

I know I'm not the first person to do Notational Velocity in Urwid, I
found Andrew Wagner and Simon Greenhill's versions and took some Urwid
tips from them:

https://github.com/drewm1980/nv-console

https://bitbucket.org/simongreenhill/n

Gmane