Coder Social home page Coder Social logo

panwid's People

Contributors

jnsnow avatar tonycpsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

panwid's Issues

pypi latest release (v0.2.5) cannot be imported on Python 3.9+

Hello,
I use panwid in a semi-personal project and I noticed it stops working on python 3.9. This is an upstream problem technically since it's blist that stops working.

I see you've been making progress towards a 0.3.* release. Any ideas on timing for the next release? (i understand you probably spend your free time on this....so, if you don't know, that's fine too :) )

Or do you think any of these dev releases for 0.3 might be stable enough to try? Im mostly just trying to weigh my options for moving to python 3.9.

Thanks!

Filters no longer filtering

Hello. I am having trouble with filters being applied/removed in examples/datatable.py when I enter 'f', and 'F', respectively. My local workaround was to simplify the filter and call self.invalidate() as shown in the the attached diff. With the patch in place, entering 'f', works as expected (i.e., I am left with records 0-4 displayed). Note, however, that using the down arrow (or mouse wheel) to scroll past the last record results in an exception. Upon entering 'F', records 0-9 are displayed, and subsequent scrolling reveals additional records as expected. I see that both apply_filters() and clear_filters() in pandwid/datatable/datatable.py include a self.invalidate() statement, but in both cases that statement has been commented out. What's the current/proper way to have filter changes take effect and be rendered on the screen? Thanks.
datatable.py.diff.txt

architecture overview of datatable

Hi, this project is awesome. I was looking for a table for urwid and stumbled across this. I've been looking through the code for a little bit, but was still a little uncertain about the basic architecture of the datatable.

That is, what is hierarchy and composition of the urwid components (e.g. list of columns, etc...). Would you mind describing this a little bit? Thanks.

Get key values from dropdown example

Just a quick question from a python newbie: looking at example/dropdown.py, how can i extract the actual selected value (key) to find associated value?

Example

data = AttrDict([('Adipisci eius dolore consectetur.', 34),
('Aliquam consectetur velit dolore', 19) ....

value = data[selected_key] (thats should be 19)

Thanks
Marco

Cell Foregroud Color

How does one set a particular cell foreground color?

Using something like urwid.Text(("red", "Text")) does not seem to work...

Example not working

Hi, I tried example/datatable.py and it shows like below on my mac:

image

What did you have been working on? I would like to help with this project.

Display Pandas DataFrame

Is it possible to provide a pandas DataFrame? This should have the same structure as what the DataTable expects but somehow I don't have success.

data_table = DataTable(
    columns = [
        DataTableColumn("path"),
        DataTableColumn("count"),
    ],
    data=DataFrame(data=[["/", 1],["/home", 2],["/tmp",3]], columns=["path", "count"]),
    cell_selection=True,
    with_scrollbar=True,
)

But I get:

TypeError: 'str' object does not support item assignment

So far I'm doing some uncoordinated hacking, If this is a dump issue, just close it uncommented.

MWE for the DataTable

I'm new to urwid and panwid and would like to build a very simple table with it. Looking thought the example it seems to be very complex. Is there any MWE available to just show the minimum necessary to get it going?

Access object behind row

How can I access the object behind a row and call a method on it, that will also update the data displayed in the table.

I have created the following MWE to show what I want.

Checked on current unstable branch (17d1fca)

#!/usr/bin/env python3

import urwid
from panwid.datatable import *
from panwid.listbox import ScrollingListBox
from urwid_utils.palette import Palette

def unhandled_input(key):
    if key in ("q", "Q"):
        raise urwid.ExitMainLoop()

class my_object():
    def __init__(self, foo, bar):
        self.foo = foo
        self.bar = bar
        self.this = self

    def action(self):
        self.foo += 1

class MyDataTable(DataTable):
    def __init__(self, *args, **kwargs):
        super(MyDataTable, self).__init__(*args, **kwargs)

    def keypress(self, size, key):
        if key == "r":
            self.refresh()
        elif key == "s":
            self.selection.data_source.this.action()
            self.selection.update()
        else:
            return super(MyDataTable, self).keypress(size, key)

def main():
    entries = ScrollingListBox.get_palette_entries()
    entries.update(DataTable.get_palette_entries())
    palette = Palette("default", **entries)

    screen = urwid.raw_display.Screen()
    screen.set_terminal_properties(256)

    data_table = MyDataTable(
        columns = [
            DataTableColumn("foo"),
            DataTableColumn("bar")
        ],
        data=[
            my_object(foo=1, bar="a"),
            my_object(foo=2, bar="b")
        ],
        cell_selection=True,
        with_scrollbar=True,
    )

    loop = urwid.MainLoop(
        urwid.Frame(data_table),
        palette = palette,
        screen=screen,
        unhandled_input=unhandled_input
    )
    loop.run()


if __name__ == "__main__":
    main()

Currently the best I can do is to set self.this = self and then call this.action() subsequently I need to perform a complete refresh (key r) to display the updated data.

Did I miss something, or how can I access the object behind the row.

cant run datatable*.py examples

Perhaps something very simple, but I get this error as I run any of the datatable examples:
Thank you!!

Traceback (most recent call last):
File "/media/sf_vboxshare/urwid-examples/panwid-main/examples/datatable_simple.py", line 62, in
main()
File "/media/sf_vboxshare/urwid-examples/panwid-main/examples/datatable_simple.py", line 53, in main
loop = urwid.MainLoop(
File "/home/money/.local/lib/python3.10/site-packages/urwid/event_loop/main_loop.py", line 127, in init
screen.register_palette(palette)
File "/home/money/.local/lib/python3.10/site-packages/urwid/display_common.py", line 1041, in register_palette
self.register_palette_entry(*item)
File "/home/money/.local/lib/python3.10/site-packages/urwid/display_common.py", line 1122, in register_palette_entry
mono = AttrSpec(mono, DEFAULT, 1)
File "/home/money/.local/lib/python3.10/site-packages/urwid/display_common.py", line 597, in init
raise AttrSpecError(
urwid.display_common.AttrSpecError: foreground/background ('white'/'default') require more colors than have been specified (1).

Refresh datatable after MainLoop running?

Hi, sorry to bother again. Is there a way to refresh datatable after MainLoop running? My data is huge, so I want to dynamic add_row() after drawing the UI.

I tried Datatable.add_row(). When I use it before MainLoop.run() it works fine, but when I use it after MainLoop.run() , the new data wasn't added to GUI table.

I want to something like urwid.Text.set_text.

Thanks.

Details toggle no longer toggling

Hello. I am having trouble getting toggle_details() to work in examples/datatable.py. When you enter '.' on a given row, the details will appear, but if you enter '.' again, they remain (i.e., they do not disappear). My local workaround was to override toggle_details() as shown in the attached diff, but I'm wondering if the root problem is that open_details() in panwid/datatable/rows.py is not setting self['_details']['open'] to True? I see that close_details() does set this value to False as a matter of course. Thanks.
datatable.py.diff.txt

Upload to pypi?

Hi me again! Dropdown is awesome! Can you upload to pypi! please!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.