Skip to content

Commit

Permalink
no more header
Browse files Browse the repository at this point in the history
  • Loading branch information
ijgnd committed Oct 3, 2019
1 parent 8921165 commit 94a0fe2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion designer/addtable.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>First row is header</string>
<string>First row is head</string>
</property>
</widget>
</item>
Expand Down
30 changes: 15 additions & 15 deletions src/addTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def fill(self):
d.sb_rows.setMaximum(gc("Table_max_rows", 100))
d.sb_rows.setValue(gc("SpinBox_row_default_value", 5))
d.cb_width.setChecked(True if gc("table_style__column_width_fixed_default", False) else False)
d.cb_first.setChecked(True if gc("table_style__first_row_is_header_default", False) else False)
d.cb_prefill.setChecked(True if gc("table_pre-populate_header_fields", False) else False)
d.cb_first.setChecked(True if gc("table_style__first_row_is_head_default", False) else False)
d.cb_prefill.setChecked(True if gc("table_pre-populate_head_fields", False) else False)

smembers = [gc('table_style__default'), ]
for s in gc('table_style_css_V2').keys():
Expand Down Expand Up @@ -165,8 +165,8 @@ def update_config(self):
["SpinBox_column_default_value", self.num_columns],
["SpinBox_row_default_value", self.num_rows],
["table_style__column_width_fixed_default", self.fixedwidth],
["table_style__first_row_is_header_default", self.useheader],
["table_pre-populate_header_fields", self.prefill],
["table_style__first_row_is_head_default", self.usehead],
["table_pre-populate_head_fields", self.prefill],
["table_pre-populate_body_fields", self.prefill],
["table_style__default", self.styling],
["table_style__h_align_default", self.table_h_align],
Expand All @@ -180,7 +180,7 @@ def accept(self):
self.num_columns = d.sb_columns.value()
self.num_rows = d.sb_rows.value()
self.fixedwidth = True if d.cb_width.isChecked() else False
self.useheader = True if d.cb_first.isChecked() else False
self.usehead = True if d.cb_first.isChecked() else False
self.prefill = True if d.cb_prefill.isChecked() else False
self.styling = d.sb_styling.currentText()
self.table_h_align = d.sb_align_H.currentText()
Expand Down Expand Up @@ -217,7 +217,7 @@ def __init__(self, editor, parent_window, selected_text):
def show_dialog(self):
d = TableDialog(self.parent_window)
if d.exec():
if d.useheader:
if d.usehead:
num_rows = d.num_rows - 1
else:
num_rows = d.num_rows
Expand All @@ -233,14 +233,14 @@ def show_dialog(self):
if d.table_v_align:
style += ' vertical-align:%s; ' % d.table_v_align

header_column = ""
if d.useheader:
head_row = ""
if d.usehead:
if d.prefill:
header_html = "<th {0}>header{1}</th>"
head_html = "<th {0}>head{1}</th>"
else:
header_html = "<th {0}>&#x200b;</th>"
head_html = "<th {0}>&#x200b;</th>"
for i in range(d.num_columns):
header_column += header_html.format(Hstyle.format(style), str(i+1))
head_row += head_html.format(Hstyle.format(style), str(i+1))

if d.prefill:
body_html = "<td {0}>data{1}</td>"
Expand All @@ -250,15 +250,15 @@ def show_dialog(self):
for i in range(d.num_columns):
body_column += body_html.format(Bstyle.format(style), str(i+1))
body_rows = "<tr>{}</tr>".format(body_column) * num_rows
self.insert_table(Tstyle, header_column, body_rows)
self.insert_table(Tstyle, head_row, body_rows)

def insert_table(self, Tstyle, header_column, body_rows):
if header_column:
def insert_table(self, Tstyle, head_row, body_rows):
if head_row:
html = """
<table {0}>
<thead><tr>{1}</tr></thead>
<tbody>{2}</tbody>
</table>""".format(Tstyle, header_column, body_rows)
</table>""".format(Tstyle, head_row, body_rows)
else:
html = """
<table {0}>
Expand Down
4 changes: 2 additions & 2 deletions src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"Table_max_cols": 10,
"Table_max_rows": 100,
"last_used_overrides_default": true,
"table_pre-populate_header_fields":true,
"table_pre-populate_head_fields":true,
"table_pre-populate_body_fields":true,
"table_style__h_align_default": "do not override global settings",
"table_style__v_align_default": "do not override global settings",
"table_style__column_width_fixed_default": true,
"table_style__default": "less ugly - minimal width",
"table_style__first_row_is_header_default": true,
"table_style__first_row_is_head_default": true,
"table_style_css_V2": {
"css1": {
"BODY_STYLING": "",
Expand Down

0 comments on commit 94a0fe2

Please sign in to comment.