by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    valadaa48
    @valadaa48
    and if not map, then perhaps inject?
    valadaa48
    @valadaa48
    ok I figured out the method of injecting input
    Ian Ward
    @wardi
    valadaa48
    @valadaa48
    aha, this is an embedded arm device I have
    it's working great btw using pipes
    and I really love what you've done
    at first I tried ./myapp.py < /dev/input/event2 but urwid choked on get key (assuming the input are keyboard scancodes). Allowing the control mapper to map any uinput code like KEY_ENTER, BTN_JOYSTICK_EAST would actually open up urwid to practically any uinput device
    /usr/include/lirc/include/linux/input-event-codes.h
    valadaa48
    @valadaa48
    also, does urwid support attributes in strings? like f"{color.RED}hello {color.BLUE}world"
    valadaa48
    @valadaa48
    @wardi if I wanted to create a 2 column layout in a Frame, setting the body to Columns([Text("foo"), Text("bar")]) doesn't seem to work
    Ideally I'm looking for a 40%/60% split
    valadaa48
    @valadaa48
    got this working
    valadaa48
    @valadaa48
    how can I disable a component from being selectable?
    tonycpsu
    @tonycpsu
    add a selectable method that returns False
    valadaa48
    @valadaa48
    @tonycpsu thank you. So I take it the only way is to subclass all of my various components?
    valadaa48
    @valadaa48
    monkey patch looks to be the ticket here
    valadaa48
    @valadaa48
    my top-level component is a frame, I would like to add a popup window. Would I need to convert top-level to be an overlay for this to work?
    also, if I wanted a popup on top of a popup, is this achievable?
    sorry for all the questions but I think my app is nearly complete and I think urwid is fantastic
    the last bit of workflow I'm trying to achieve is: popup context window when clicking on a menu item and this context window would have the ability to popup a confirmation dialog
    tonycpsu
    @tonycpsu
    @valadaa48 i've never done a popup from a popup but it should work
    examples/pop_up.py shows how it works
    valadaa48
    @valadaa48
    thank you
    valadaa48
    @valadaa48
    I'm setting loop.widget = term (Terminal) if the user hits a button but I'm not sure how I might be able to exit out of the terminal using a keystroke back to the main menu
    valadaa48
    @valadaa48
    ok figured that one out
    valadaa48
    @valadaa48
    is the advised way of having multiple "screens" to replace loop.widget?
    i.e, if I have 2 Frames the user can switch via F1/F2
    Ian Ward
    @wardi
    @valadaa48 WidgetPlaceholder IIRC
    then you're not tied to switching loop.widget, you can switch out widgets wherever you need
    valadaa48
    @valadaa48
    ok great
    my app is coming along nicely
    I'm very glad I tried urwid before doing this in python curses directly
    mimansa-dev
    @mimansa-dev
    Is there a way to have a urwid app to do a sys.exit() after a configurable timeout if no input has been received from the user in more than 30 seconds?
    Neil Pilgrim
    @neiljp
    Is there some way to get horizontal layout that I'm missing, that allows multi-line/row flow but isn't fixed width like GridFlow? Columns don't seem to accept flow over multiple rows except within boxes of a given row, which isn't quite what I'm looking for.
    Some columns that are too wide just don't get rendered in a fixed width, which I can avoid using a box-column right now, but doesn't really give the right layout.
    Neil Pilgrim
    @neiljp
    I'm thinking of something like a GridFlow, but where it flows onto multiple lines if there isn't enough space to fit on one line. A good example might be something like 'breadcrumbs', ie. "large area > smaller area > tiny", where they might be broken up into multiple lines at the '>' boundary if the width shrinks, but in chunks a little like Columns, over multiple rows like GridFlow but not with fixed widths for each chunk.
    Ian Ward
    @wardi
    you might need to make your own widget that manages its children the way you want, take a look at the source for GridFlow IIRC it uses Columns and Pile widgets based on the size given
    Neil Pilgrim
    @neiljp
    This seems like a fairly useful general case, ie. horizontal flow, and I was surprised it wasn't a standard widget - do you think it could be one if it was developed?
    Ian Ward
    @wardi
    sure if it's general enough
    valadaa48
    @valadaa48
    has anyone worked out a way of getting more than 16/8 colors in the linux console?
    I don't think it's supported but figure you guys might know of any tricks
    also utf-8 glyphs seem to be a challenge as well
    Neil Pilgrim
    @neiljp
    unicode works for me, but only the simpler ones, and presumably it depends on the font too.
    Neil Pilgrim
    @neiljp
    We definitely have issues with 'complex' unicode in zulip-term, which is why we currently default to expand emoji into short names - it tends to shift the layout otherwise, in some cases.
    valadaa48
    @valadaa48
    is that in the linux console or via x/wayland?
    valadaa48
    @valadaa48
    class MyButton(urwid.Button): def __init__(self, caption): super(MyButton, self).__init__("") self._w = urwid.AttrMap( urwid.SelectableIcon(caption, 0), "button", "button_focus" )
    I'm using that, but I can't seem to make not selectable
    I tried button._selectable = False
    valadaa48
    @valadaa48
    anyone aware of an onscreen keyboard implementation within urwid?
    Maxim Ivanov
    @ulidtko

    @mimansa-dev Is there a way to have a urwid app to do a sys.exit() after a configurable timeout if no input has been received from the user in more than 30 seconds?

    Yes. Check out urwid.MainLoop, it has methods to set timers