New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grid (beta) cell over-padding with small fonts #388

Closed
Paul47 opened this Issue Feb 18, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@Paul47

Paul47 commented Feb 18, 2018

appJar has simplified my hobby apps - great module. When I reduce grid font size down to 10 there is excessive padding on both sides of the text. Can't display more than 10-15 characters in 4-5 columns before the window is extremely wide. Also I cannot left justify/W the text. Tried a number of label and grid manager combinations with no success. For this test I pasted in the simple grid example for the Grid web page.

@jarvisteach

This comment has been minimized.

Owner

jarvisteach commented Feb 18, 2018

Hi @Paul47 - yep, there are still lots of things to improve on the grid widget. In the latest development build, there are some improvements - you could try this out on the next_release branch (NB. grid has been renamed to table in that release).

How are you adjusting the font? The Grid's current support for changing fonts is not great, so that could be causing some of the issues...

Could you post a sample of your code so I can test it out, as well as what platform you're on?

@jarvisteach jarvisteach added this to the 1.0 milestone Feb 18, 2018

@jarvisteach jarvisteach added the bug label Feb 18, 2018

@Paul47

This comment has been minimized.

Paul47 commented Feb 18, 2018

Thanks for the quick response and support on your widgets. I used the grid sample code from here: http://appjar.info/pythonDevWidgets/. appJar_3.py I downloaded from github last week. I reduced the font size with app.setFont(size=10).

The next_release version is also missing the lines around the label boxes. I'm using windows 10 Visual Studio.

I can test any grid enhancements you make, but I'm not Python experienced enough yet to make edits to your module.

I'm writing an app to compare and edit 3D printing slicers. Both Slic3r and CURA slice 3D images into layers. CURA has over 100 control parameters stored in several XML files for each 'profile.' I end up many dozens of ini files that define the print details with no practical way to track the changes between them. Learning Python because file handling and grid displays appeared ideal for Python.

`
#simple grid test from website
#http://appjar.info/pythonDevWidgets/#grid
#Paul Dymerski pdymersk@gmail.com

from appjar import gui
appjar = 'next'

#from appJar_3 import gui
#appjar = 'None'

app = gui()
app.setFont(size=10)

if (appjar == 'next'):
app.addTable("g1",
[["Name", "Age", "Gender"],
["Fred", 45, "Male"],
["Tina", 37, "Female"],
["Clive", 28, "Male"],
["Betty", 51, "Female"]])
else:
app.addGrid("g1",
[["Name", "Age", "Gender"],
["Fred", 45, "Male"],
["Tina", 37, "Female"],
["Clive", 28, "Male"],
["Betty", 51, "Female"]])
app.go()`

jarvisteach added a commit that referenced this issue Feb 18, 2018

@jarvisteach

This comment has been minimized.

Owner

jarvisteach commented Feb 18, 2018

Hi Paul, I'm not seeing the issues you mention on Mac or Linux:
issue388

There's very little padding in the labels, the text fills nearly all of the space.

So, the only thing I can think of, is that the table has a set width/height. So with the example you included, you get empty space in the labels, as the table stretches to fill the space:
issue388

If you adjust the GUI size, then it all shrinks down:
issue388

I've flattened out the look in next_release so there is now just a simple black grid around the cells - what do you think?

@jarvisteach

This comment has been minimized.

Owner

jarvisteach commented Feb 18, 2018

To change the gui size, try this line for constructing the gui:
app = gui("Table Demo", "100x100")

@Paul47

This comment has been minimized.

Paul47 commented Feb 19, 2018

Thanks for the guidance. This line gave me control of the size:"with gui("Grid Demo", "600x400", useSettings=False) as app:" Using fields with only a few characters or one number was misleading. I added actual field data from a slicer ini file. I think setting the box size somewhat smaller than the useSetting=True will do the trick for my app. Thanks!

For the line style, the thick lines overpower small fonts like 10 and 12pt. Single lines (aka excel) or double (appJar previous versions) look more professional.

Manually set size for the expected data field widths.
table_narrow

Dragged wider
table_wide

jarvisteach added a commit that referenced this issue Mar 1, 2018

testing issue #388
Fixed Db table problems in #266
* Can’t check for Cursor, unless sqlite3 is imported
* Fixed use of max to count num columns

jarvisteach added a commit that referenced this issue Mar 2, 2018

jarvisteach added a commit that referenced this issue Mar 2, 2018

Updated table border param #388
Now passed as a named parameter
@jarvisteach

This comment has been minimized.

Owner

jarvisteach commented Mar 2, 2018

@Paul47 there is now the option to choose which style you want....
When you create the table, you can set a border parameter, some of the options are solid, sunken, raised

@jarvisteach jarvisteach added question enhancement and removed bug labels Mar 3, 2018

jarvisteach added a commit that referenced this issue Mar 3, 2018

@jarvisteach jarvisteach closed this Mar 3, 2018

@Paul47

This comment has been minimized.

Paul47 commented Mar 10, 2018

For border I tried: app.addTable("Table", [headerFields], action=None, addRow=None, showMenu=True, border='RIDGE') . This only produced a thin border line for all 5 options as compared to a thicker single line w/o border=. Am I in the right call?

The table display was very slow with this release. 100 rows took 50 seconds to display. `def

Playing with the previous version I was able to produce a working table for my needs:

`
#Working Tabel
def drawTable(headerFields, tokenFields):
#not sure how to change the Ture (SAVED) settings
#top label
app.setStretch("column") #>>>strange - expands top area id commented out
app.addLabel("title", "Table Widget Test")
app.setLabelFg("title", "red") #these 2 only affects the label - .configure overrides
app.setLabelBg("title", "white")
app.label("title", justify="left")
#add buttons
with app.labelFrame("LabelFrame Text", hideTitle=True):
app.addButtons(["Add File", "Save", "Done"], pressBtn)
app.setButtonFont(family="times", size=12, weight="bold") #sets only button fonts

#Sets label fg/bg AND the cell text but bg only 
app.setLabelFont(family="Courier", size=10)         #Sets label AND the cell text 
app.configure(fg="dark blue", bg='white')          #fg Sets label color, but NOT the tabel. bg effects both


# order is [ [row0: title1,,,,titlen][row1:col1,,,,coln],[row2:col1,,,,coln],... ]
app.addTable("Table", [headerFields], action=None, addRow=None, showMenu=True)  #, border='RIDGE'

#actual Table space whether filled by rows/columns or not - NOT the window size
#>> Table must be named first
app.setTableHeight("Table",800)
app.setTableWidth("Table", 10)           #>>>doesn't work

#add rows
for row in range (len(tokenFields)):
    app.addTableRow("Table", tokenFields[row])
#end for

return

#end drawTable
`
slic3r table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment