tonycpsu / panwid Goto Github PK
View Code? Open in Web Editor NEWA collection of widgets for urwid.
License: GNU Lesser General Public License v2.1
A collection of widgets for urwid.
License: GNU Lesser General Public License v2.1
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!
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
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.
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
How does one set a particular cell foreground color?
Using something like urwid.Text(("red", "Text"))
does not seem to work...
Given that panwid use is closely tied to urwid, would you consider switching to the same license urwid is using (LGPLv2.1)?
https://github.com/urwid/urwid/blob/master/COPYING
With only two contributors so far, it hopefully shouldn't be too hard to reach agreement (assuming it's something you feel comfortable doing).
Could you include doc/ and examples/ in your release tarballs ? That would make it easier for distribution packagers to make those directories part of their packages. See for instance https://bugs.debian.org/944313.
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.
How do selected rows highlight? Thank you!
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?
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.
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).
Now that https://github.com/MinchinWeb/colourettu supports python 3, the datable could use it.
Hi, I am creating a wireshark clone on terminal, thanks to your awesome work!
And I have few questions about your datatable.
wrap
paramter, useful!footer_fn
(https://github.com/tonycpsu/panwid/blob/master/panwid/datatable/datatable.py#L47) use for? I just see you set it but don't use it in anywhere.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.
I see commented code in dropdown.py
`
# self._items = items
# self.make_selection([label for (label, value) in items if
# value is selected_value][0],
# selected_value)
`
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
Hi me again! Dropdown is awesome! Can you upload to pypi! please!
How can focus jump out of datatable without scrolling to the end of datatable?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.