Skip to content

Commit 5afacee

Browse files
committed
make config menus look better
1 parent f8a638d commit 5afacee

File tree

1 file changed

+34
-28
lines changed

1 file changed

+34
-28
lines changed

h2o/config.py

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,28 @@ def __init__(self):
3737
self.l = QVBoxLayout()
3838
self.setLayout(self.l)
3939
self.linebreak = "=" * 80
40+
self.spacing = 10
4041

4142
# header
42-
self.config_label = QLabel('Highlights to Obsidian Config', self)
43+
self.config_label = QLabel('<b>Highlights to Obsidian Config</b>', self)
4344
self.l.addWidget(self.config_label)
4445

46+
self.l.addSpacing(self.spacing)
47+
4548
self.formatting_dialog = FormattingDialog()
4649
self.format_config_button = QPushButton("Formatting Options")
4750
self.format_config_button.clicked.connect(self.formatting_dialog.exec)
4851
self.l.addWidget(self.format_config_button)
4952

53+
self.l.addSpacing(self.spacing)
54+
5055
self.other_dialog = OtherConfigDialog()
5156
self.other_config_button = QPushButton("Other Options")
5257
self.other_config_button.clicked.connect(self.other_dialog.exec)
5358
self.l.addWidget(self.other_config_button)
5459

60+
self.l.addSpacing(self.spacing)
61+
5562
def save_settings(self):
5663
# saving is handled in the config dialog classes
5764
pass
@@ -65,27 +72,27 @@ def __init__(self):
6572
self.linebreak = "=" * 80
6673
self.spacing = 20 # pixels
6774

68-
self.title_label = QLabel("Formatting Options")
75+
self.title_label = QLabel("<b>Highlights to Obsidian Formatting Options</b>")
6976
self.l.addWidget(self.title_label)
7077
self.title_linebreak = QLabel(self.linebreak)
7178
self.l.addWidget(self.title_linebreak)
7279

7380
# note formatting info
74-
format_info = "The title and body have the following formatting options. " + \
81+
format_info = "The following formatting options are available. " + \
7582
"To use one, put it in curly brackets, as in {title} or {blockquote}."
7683
self.note_format_label = QLabel(format_info, self)
7784
self.l.addWidget(self.note_format_label)
7885

79-
self.note_format_list_labels = []
80-
self.make_format_info_labels()
86+
self.note_format_list_label = None
87+
self.make_format_info_label()
8188

8289
self.info_linebreak = QLabel(self.linebreak)
8390
self.l.addWidget(self.info_linebreak)
8491

8592
self.l.addSpacing(self.spacing)
8693

8794
# obsidian note title format
88-
self.title_format_label = QLabel('Note title format:', self)
95+
self.title_format_label = QLabel('<b>Note title format:</b>', self)
8996
self.l.addWidget(self.title_format_label)
9097

9198
self.title_format_input = QLineEdit(self)
@@ -97,7 +104,7 @@ def __init__(self):
97104
self.l.addSpacing(self.spacing)
98105

99106
# obsidian note body format
100-
self.body_format_label = QLabel('Note body format:', self)
107+
self.body_format_label = QLabel('<b>Note body format:</b>', self)
101108
self.l.addWidget(self.body_format_label)
102109

103110
self.body_format_input = QPlainTextEdit(self)
@@ -109,7 +116,7 @@ def __init__(self):
109116
self.l.addSpacing(self.spacing)
110117

111118
# obsidian no notes body format
112-
self.no_notes_format_label = QLabel('Body format for highlights without notes (if empty, defaults to the above):',
119+
self.no_notes_format_label = QLabel('<b>Body format for highlights without notes</b> (if empty, defaults to the above):',
113120
self)
114121
self.l.addWidget(self.no_notes_format_label)
115122

@@ -122,22 +129,22 @@ def __init__(self):
122129
self.l.addSpacing(self.spacing)
123130

124131
# label for header formatting options
125-
self.header_format_label = QLabel('Header format (cannot use highlight-specific formatting options):', self)
132+
self.header_format_label = QLabel('<b>Header format</b> (avoid highlight-specific data like {highlight} or {url}):', self)
126133
self.l.addWidget(self.header_format_label)
127134

128-
# checkbox to disable or enable using header
129-
self.header_checkbox = QCheckBox("Use header when sending highlights")
130-
if prefs['use_header']:
131-
self.header_checkbox.setChecked(True)
132-
self.l.addWidget(self.header_checkbox)
133-
134135
# text box for header formatting options
135136
self.header_format_input = QPlainTextEdit(self)
136137
self.header_format_input.setPlainText(prefs['header_format'])
137138
self.header_format_input.setPlaceholderText("Header format...")
138139
self.l.addWidget(self.header_format_input)
139140
self.header_format_label.setBuddy(self.header_format_input)
140141

142+
# checkbox to disable or enable using header
143+
self.header_checkbox = QCheckBox("Use header when sending highlights")
144+
if prefs['use_header']:
145+
self.header_checkbox.setChecked(True)
146+
self.l.addWidget(self.header_checkbox)
147+
141148
self.l.addSpacing(self.spacing)
142149

143150
# ok and cancel buttons
@@ -147,7 +154,7 @@ def __init__(self):
147154
self.buttons.rejected.connect(self.cancel_button)
148155
self.l.addWidget(self.buttons)
149156

150-
def make_format_info_labels(self):
157+
def make_format_info_label(self):
151158

152159
# list of formatting options
153160
format_options = [
@@ -178,10 +185,9 @@ def make_format_info_labels(self):
178185
char_count = 0
179186
strs.append(f_opt_str[start_idx:])
180187

181-
for s in strs:
182-
label = QLabel(s, self)
183-
self.note_format_list_labels.append(label)
184-
self.l.addWidget(label)
188+
one_str = "<br/>".join(strs)
189+
self.note_format_list_label = QLabel(one_str, self)
190+
self.l.addWidget(self.note_format_list_label)
185191

186192
time_note = QLabel("Note that times are the time the highlight was made, not the current time " + \
187193
"(except 'utcnow' and 'localnow').")
@@ -207,20 +213,20 @@ def __init__(self):
207213
QDialog.__init__(self)
208214
self.l = QVBoxLayout()
209215
self.setLayout(self.l)
210-
self.linebreak = "=" * 80
216+
self.linebreak = "=" * 50
211217
self.spacing = 20 # pixels
212218

213219
self.setWindowTitle("Highlights to Obsidian: Other Configuration Options")
214220

215-
self.title_label = QLabel("Other configuration options")
221+
self.title_label = QLabel("<b>Highlights to Obsidian Other Options</b>")
216222
self.l.addWidget(self.title_label)
217223
self.title_linebreak = QLabel(self.linebreak)
218224
self.l.addWidget(self.title_linebreak)
219225

220226
self.l.addSpacing(self.spacing)
221227

222228
# obsidian vault name
223-
self.vault_label = QLabel('Obsidian vault name:', self)
229+
self.vault_label = QLabel('<b>Obsidian vault name:</b>', self)
224230
self.l.addWidget(self.vault_label)
225231

226232
self.vault_input = QLineEdit(self)
@@ -232,9 +238,9 @@ def __init__(self):
232238
self.l.addSpacing(self.spacing)
233239

234240
# sort key
235-
self.sort_label = QLabel("Sort key: used to sort highlights that get sent to the same file. "
236-
+ "(Sort key can be any of the formatting option. No brackets. "
237-
+ "For example, timestamp or location.)", self)
241+
self.sort_label = QLabel("<b>Sort key:</b> used to sort highlights that get sent to the same file.<br/>"
242+
+ "(Sort keys can be any of H2O's formatting options. No brackets. "
243+
+ "For example, <br/>timestamp or location.)", self)
238244
self.l.addWidget(self.sort_label)
239245

240246
self.sort_input = QLineEdit(self)
@@ -245,11 +251,11 @@ def __init__(self):
245251
self.l.addSpacing(self.spacing)
246252

247253
# time setting
248-
self.time_label = QLabel('Last time highlights were sent (highlights made after this are considered new)', self)
254+
self.time_label = QLabel('<b>Last time highlights were sent</b> (highlights made after this are considered new)', self)
249255
self.l.addWidget(self.time_label)
250256

251257
# time format info
252-
self.time_format_label = QLabel("Time must be formatted: \"YYYY-MM-DD hh:mm:ss\"")
258+
self.time_format_label = QLabel("Time must be formatted \"YYYY-MM-DD hh:mm:ss\"")
253259
self.l.addWidget(self.time_format_label)
254260

255261
self.time_input = QLineEdit(self)

0 commit comments

Comments
 (0)