2020
2121Main 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
3024import os
3125import filecmp
3226import re
3327import traceback
34- from shutil import copy , copyfile
3528import pickle
3629import tarfile
30+ from shutil import copy , copyfile
3731from tempfile import TemporaryDirectory
3832from 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+
4541import 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
4646from mynoteslib .config import Config
4747from 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
0 commit comments