Skip to content

Commit 8ed18b3

Browse files
committed
Merge branch 'settings'
- Improve settings subpackage structure - Fix opacity setting - Improve title bar underline style - Improve PEP8 compliance
2 parents 71be8ee + bed3544 commit 8ed18b3

23 files changed

Lines changed: 586 additions & 304 deletions

mynotes

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding:Utf-8 -*-
33
"""
44
MyNotes - Sticky notes/post-it
5-
Copyright 2016-2018 Juliette Monsel <j_4321@protonmail.com>
5+
Copyright 2016-2019 Juliette Monsel <j_4321@protonmail.com>
66
77
MyNotes is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -20,20 +20,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
2121
Main
2222
"""
23-
24-
23+
import logging
2524
import os
2625
import sys
2726
import traceback
2827
import signal
2928
from tkinter import Tk
3029
from tkinter.ttk import Style
30+
import argparse
31+
3132
from mynoteslib.constants import save_config, PIDFILE
3233
from mynoteslib.app import App
3334
from mynoteslib.messagebox import showerror
34-
import logging
3535
from mynoteslib.version import __version__
36-
import argparse
36+
3737

3838
# parse command line arguments
3939
parser = argparse.ArgumentParser(description=_("MyNotes - Post-it system tray app"),

mynoteslib/about.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding:Utf-8 -*-
33
"""
44
MyNotes - Sticky notes/post-it
5-
Copyright 2016-2018 Juliette Monsel <j_4321@protonmail.com>
5+
Copyright 2016-2019 Juliette Monsel <j_4321@protonmail.com>
66
77
MyNotes is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -22,8 +22,10 @@
2222
"""
2323
from webbrowser import open as webOpen
2424
from tkinter import Text, Toplevel
25-
from PIL.ImageTk import PhotoImage
2625
from tkinter.ttk import Button, Label, Style
26+
27+
from PIL.ImageTk import PhotoImage
28+
2729
from mynoteslib.constants import IM_ICON_48
2830
from mynoteslib.version import __version__
2931

@@ -49,7 +51,7 @@ def __init__(self, master):
4951
columnspan=2,
5052
padx=10)
5153
Label(self,
52-
text="Copyright (C) Juliette Monsel 2016-2018").grid(row=3,
54+
text="Copyright (C) Juliette Monsel 2016-2019").grid(row=3,
5355
columnspan=2,
5456
padx=10)
5557
Label(self,

mynoteslib/app.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,29 @@
2020
2121
Main class
2222
"""
23-
24-
from tkinter import Tk, TclError
25-
from tkinter import PhotoImage as tkPhotoImage
26-
from tkinter.ttk import Style
27-
from tkinter.font import families
28-
from PIL import Image
29-
from PIL.ImageTk import PhotoImage
23+
import signal
3024
import os
3125
import filecmp
3226
import re
3327
import traceback
34-
from shutil import copy, copyfile
3528
import pickle
3629
import tarfile
30+
from shutil import copy, copyfile
3731
from tempfile import TemporaryDirectory
3832
from time import strftime
39-
import signal
40-
from mynoteslib.trayicon import TrayIcon, SubMenu
41-
from mynoteslib.constants import CONFIG, PATH_DATA, PATH_DATA_BACKUP,\
42-
LOCAL_PATH, backup, asksaveasfilename, askopenfilename, COLORS, \
43-
IM_SCROLL_ALPHA, IM_VISIBLE, IM_HIDDEN, IM_SELECT, IM_SORT_REV, IM_ROLL, \
44-
TEXT_COLORS, color_box, PATH_LATEX, PATH_LOCAL_DATA
33+
from tkinter import Tk, TclError
34+
from tkinter import PhotoImage as tkPhotoImage
35+
from tkinter.ttk import Style
36+
from tkinter.font import families
37+
38+
from PIL import Image
39+
from PIL.ImageTk import PhotoImage
40+
4541
import mynoteslib.constants as cst
42+
from mynoteslib.trayicon import TrayIcon, SubMenu
43+
from mynoteslib.constants import CONFIG, COLORS, TEXT_COLORS,\
44+
PATH_DATA, PATH_DATA_BACKUP, LOCAL_PATH, PATH_LATEX, PATH_LOCAL_DATA,\
45+
asksaveasfilename, askopenfilename
4646
from mynoteslib.config import Config
4747
from mynoteslib.export import Export, EXT_DICT, MERGE_FCT, EXPORT_FCT, \
4848
make_archive, export_filename
@@ -66,19 +66,19 @@ def __init__(self, args):
6666
self.notes = {}
6767
self.im_icon = PhotoImage(master=self, file=cst.IM_ICON_48)
6868
self.iconphoto(True, self.im_icon)
69-
self.im_visible = PhotoImage(file=IM_VISIBLE, master=self)
70-
self.im_hidden = PhotoImage(file=IM_HIDDEN, master=self)
71-
self.im_select = PhotoImage(file=IM_SELECT, master=self)
72-
self.im_sort_rev = PhotoImage(file=IM_SORT_REV, master=self)
73-
self.im_sort = PhotoImage(file=IM_ROLL, master=self)
69+
self.im_visible = PhotoImage(file=cst.IM_VISIBLE, master=self)
70+
self.im_hidden = PhotoImage(file=cst.IM_HIDDEN, master=self)
71+
self.im_select = PhotoImage(file=cst.IM_SELECT, master=self)
72+
self.im_sort_rev = PhotoImage(file=cst.IM_SORT_REV, master=self)
73+
self.im_sort = PhotoImage(file=cst.IM_ROLL, master=self)
7474

7575
# color boxes for menus
7676
self.im_text_color = {}
7777
for name, value in TEXT_COLORS.items():
78-
self.im_text_color[name] = PhotoImage(color_box(value), master=self)
78+
self.im_text_color[name] = PhotoImage(cst.color_box(value), master=self)
7979
self.im_color = {}
8080
for name, value in COLORS.items():
81-
self.im_color[name] = PhotoImage(color_box(value), master=self)
81+
self.im_color[name] = PhotoImage(cst.color_box(value), master=self)
8282

8383
# --- style
8484
style = Style(self)
@@ -146,7 +146,7 @@ def __init__(self, args):
146146
active_bg = cst.active_color(color)
147147
active_bg2 = cst.active_color(cst.active_color(color, 'RGB'))
148148
active_bg3 = cst.active_color(cst.active_color(cst.active_color(color, 'RGB'), 'RGB'))
149-
slider_alpha = Image.open(IM_SCROLL_ALPHA)
149+
slider_alpha = Image.open(cst.IM_SCROLL_ALPHA)
150150
slider_vert = Image.new('RGBA', (13, 28), active_bg)
151151
slider_vert.putalpha(slider_alpha)
152152
slider_vert_active = Image.new('RGBA', (13, 28), active_bg3)
@@ -272,7 +272,7 @@ def __init__(self, args):
272272
_("The data is corrupted, an older backup has been restored and there might be some data losses."))
273273

274274
else:
275-
backup()
275+
cst.backup()
276276
for i, key in enumerate(note_data):
277277
self.note_data["%i" % i] = note_data[key]
278278

mynoteslib/checkboxtreeview.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding:Utf-8 -*-
33
"""
44
MyNotes - Sticky notes/post-it
5-
Copyright 2016-2018 Juliette Monsel <j_4321@protonmail.com>
5+
Copyright 2016-2019 Juliette Monsel <j_4321@protonmail.com>
66
77
MyNotes is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -19,11 +19,12 @@
1919
2020
Treeview with checkboxes at each item
2121
"""
22-
2322
from tkinter.ttk import Treeview, Style
24-
from mynoteslib.constants import IM_CHECKED, IM_UNCHECKED, IM_TRISTATE
23+
2524
from PIL.ImageTk import PhotoImage
2625

26+
from mynoteslib.constants import IM_CHECKED, IM_UNCHECKED, IM_TRISTATE
27+
2728

2829
class CheckboxTreeview(Treeview):
2930
"""

mynoteslib/config/autocorrect.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding:Utf-8 -*-
33
"""
44
MyNotes - Sticky notes/post-it
5-
Copyright 2016-2018 Juliette Monsel <j_4321@protonmail.com>
5+
Copyright 2016-2019 Juliette Monsel <j_4321@protonmail.com>
66
77
MyNotes is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -20,11 +20,10 @@
2020
2121
Configuration window for autocorrect
2222
"""
23-
24-
2523
from tkinter import StringVar
2624
from tkinter.ttk import Treeview, Frame, Label, Button, Entry
27-
from mynoteslib.constants import AUTOCORRECT
25+
26+
from mynoteslib.constants import AUTOCORRECT, add_trace
2827
from mynoteslib.autoscrollbar import AutoScrollbar
2928

3029

@@ -49,12 +48,8 @@ def __init__(self, master, app, **kwargs):
4948
self.replace = StringVar(self)
5049
self.by = StringVar(self)
5150

52-
try:
53-
self.replace.trace_add('write', self._trace_replace)
54-
self.by.trace_add('write', self._trace_by)
55-
except AttributeError:
56-
self.replace.trace_add('w', self._trace_replace)
57-
self.by.trace_add('w', self._trace_by)
51+
add_trace(self.replace, 'write', self._trace_replace)
52+
add_trace(self.by, 'write', self._trace_by)
5853

5954
b_frame = Frame(self)
6055
self.b_add = Button(b_frame, text=_('New'), command=self.add)

mynoteslib/config/categories.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding:Utf-8 -*-
33
"""
44
MyNotes - Sticky notes/post-it
5-
Copyright 2016-2017 Juliette Monsel <j_4321@protonmail.com>
5+
Copyright 2016-2019 Juliette Monsel <j_4321@protonmail.com>
66
77
MyNotes is free software: you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -20,12 +20,13 @@
2020
2121
Category Manager
2222
"""
23-
2423
from tkinter import StringVar, Toplevel, Text
24+
from tkinter.ttk import Label, Button, OptionMenu, Style, Entry, Frame
25+
2526
from PIL.ImageTk import PhotoImage
27+
2628
from mynoteslib.constants import CONFIG, COLORS, INV_COLORS, IM_PLUS, IM_DELETE
2729
from mynoteslib.constants import save_config, optionmenu_patch
28-
from tkinter.ttk import Label, Button, OptionMenu, Style, Entry, Frame
2930
from mynoteslib.messagebox import askyesnocancel
3031
from mynoteslib.autoscrollbar import AutoScrollbar
3132

0 commit comments

Comments
 (0)