3121 lines
124 KiB
Python
Executable File
3121 lines
124 KiB
Python
Executable File
#!/usr/bin/env python
|
|
# ##### BEGIN GPL LICENSE BLOCK #####
|
|
#
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License
|
|
# as published by the Free Software Foundation; either version 2
|
|
# of the License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
#
|
|
# ##### END GPL LICENSE BLOCK #####
|
|
#
|
|
# The python program AFM_thumbs creates a pdf file, which shows all SPM
|
|
# (Scanning Probe Microscopy: like AFM, STM, KPFM, etc.) images and relevant
|
|
# data stored in a directory. In first place, AFM_thumbs is interesting for
|
|
# scientists, who would like to obtain an overview of their SPM data.
|
|
# Supported SPM data: Omicron SCALA, Nanotec Dulicinea and RHK
|
|
#
|
|
# AFM_thumbs
|
|
# ==========
|
|
#
|
|
# Main author and project manager : Clemens Barth
|
|
# barth@root-1.de
|
|
#
|
|
# Main-author : Niklas Rethmann
|
|
# nrethmann@uni-osnabrueck.de
|
|
#
|
|
#
|
|
# Start of project : 2012/02/16, Clemens Barth
|
|
# Restructure of project : 2014/03/28, Clemens Barth
|
|
# Niklas Rethmann
|
|
# Transition to Python 3.x : 2022/02/17, Clemens Barth
|
|
#
|
|
#
|
|
# 2022/03/02
|
|
# ==========
|
|
# - Bug removal in SPECS_Nanonis.py: do not prepare amplitude
|
|
# string if it is, e.g., a STM measurement.
|
|
#
|
|
# 2022/02/17
|
|
# ==========
|
|
# - Transition to python 3.x
|
|
#
|
|
# 2022/01/28-29
|
|
# =============
|
|
# - The Nanonis spectroscopy (text info) has been entirely re-structured
|
|
# - Code for including Nanonis NPC and FCA spectroscopy curves
|
|
# - Code cleaning
|
|
#
|
|
# 2021/02/07
|
|
# ==========
|
|
# - The code for adjusting the image contrast was considerably improved.
|
|
# In particular Nanonis images, which were not recorded until the end
|
|
# of the image frame, are better treated: the region of 'now data' is
|
|
# not considered.
|
|
# - Code cleaning
|
|
#
|
|
# 2021/02/06
|
|
# ==========
|
|
# - Nanonis images with NaNs are now considered. The NaN values are all
|
|
# put onto zero.
|
|
# - Bug removal: if a directory contained only one Nanonis file, it was
|
|
# not considered. This has been solved.
|
|
# - All non-contact and KPFM channels in Nanonis files are now treated.
|
|
# - Code cleaning
|
|
#
|
|
# 2021/02/05
|
|
# ==========
|
|
# - Bad fonts are excluded
|
|
# - Nanonis: the speed info now has a better format.
|
|
#
|
|
# 2021/01/21
|
|
# ==========
|
|
# - First implementation of Nanonis .sxm files
|
|
# - Code cleaning
|
|
#
|
|
# 2018/09/12
|
|
# ==========
|
|
# - If there is a bad font like 'NotoColorEmoji.ttf' then it will be
|
|
# not considered.
|
|
#
|
|
# 2017/07/28
|
|
# ==========
|
|
# - All spectra of Omicron SCALA data are considered.
|
|
# - Spectra data always starts with a new row, the same for
|
|
# following images. DULCINEA has not yet spectra implemented.
|
|
# RHK: still needs to be done.
|
|
#
|
|
# 2017/06/25
|
|
# ==========
|
|
# - 3 digits for Ugap
|
|
# - Console output: Change from 'Date' to 'Today'
|
|
#
|
|
#
|
|
#
|
|
#
|
|
# ##### BEGIN NOTE #####
|
|
#
|
|
# This Python script is free for use. Me and others have put a huge effort
|
|
# into creating this nice program!
|
|
# PLEASE, if you modify this script, respect the following steps:
|
|
#
|
|
# 1. DO NOT REMOVE OUR NAMES FROM THE PREAMBLE AND KEEP ME AS A PROJECT MANAGER.
|
|
# 2. Send your new version by Email to:
|
|
#
|
|
# barth@root-1.de and
|
|
#
|
|
# 3. Keep the PEP-8 programming rules when coding:
|
|
# http://legacy.python.org/dev/peps/pep-0008/
|
|
#
|
|
# Thank you!
|
|
#
|
|
# Dr. Clemens Barth, February 2022
|
|
#
|
|
# ##### END NOTE #####
|
|
#
|
|
# DO NOT REMOVE THIS PREAMBLE !!!
|
|
|
|
|
|
|
|
from tkinter import *
|
|
import tkinter.filedialog as filedialog
|
|
import tkinter.messagebox as messagebox
|
|
import tkinter.ttk as ttk
|
|
|
|
|
|
import os
|
|
import platform
|
|
import matplotlib
|
|
from timeit import default_timer as timer
|
|
from datetime import datetime, timedelta
|
|
|
|
from AFM_thumbs.Linalg import initialize_linalg
|
|
from AFM_thumbs.Variables import globvar_configfile
|
|
from AFM_thumbs.Variables import globvar_configfile_path
|
|
from AFM_thumbs.Variables import globvar_AFMdir
|
|
from AFM_thumbs.Variables import globvar_ThumbPara
|
|
from AFM_thumbs.Variables import globvar_spaces
|
|
from AFM_thumbs.Variables import globvar_timepassed_1
|
|
from AFM_thumbs.Variables import globvar_timepassed_2
|
|
from AFM_thumbs.Variables import globvar_console
|
|
from AFM_thumbs.Variables import globvar_bar_title
|
|
from AFM_thumbs.Variables import globvar_name
|
|
from AFM_thumbs.Variables import globvar_note
|
|
from AFM_thumbs.Variables import globvar_thumb_size_x
|
|
from AFM_thumbs.Variables import globvar_thumb_size_y
|
|
from AFM_thumbs.Variables import TT_n_col
|
|
from AFM_thumbs.Variables import TT_n_row
|
|
from AFM_thumbs.Variables import TT_rms
|
|
from AFM_thumbs.Variables import TT_res
|
|
from AFM_thumbs.Variables import TT_qual
|
|
from AFM_thumbs.Variables import TT_size
|
|
from AFM_thumbs.Variables import TT_dx_pos
|
|
from AFM_thumbs.Variables import TT_dy_pos
|
|
from AFM_thumbs.Variables import TT_dw
|
|
from AFM_thumbs.Variables import TT_file_ex
|
|
from AFM_thumbs.Variables import TT_master_dir
|
|
from AFM_thumbs.Variables import TT_filename
|
|
from AFM_thumbs.Variables import TT_date
|
|
from AFM_thumbs.Variables import TT_size_nm
|
|
from AFM_thumbs.Variables import TT_size_px
|
|
from AFM_thumbs.Variables import TT_off
|
|
from AFM_thumbs.Variables import TT_vol
|
|
from AFM_thumbs.Variables import TT_feed
|
|
from AFM_thumbs.Variables import TT_loop
|
|
from AFM_thumbs.Variables import TT_speed
|
|
from AFM_thumbs.Variables import TT_amp
|
|
from AFM_thumbs.Variables import TT_angle
|
|
from AFM_thumbs.Variables import TT_thumb_before
|
|
from AFM_thumbs.Variables import TT_thumb_after
|
|
from AFM_thumbs.Variables import TT_extra_dir
|
|
from AFM_thumbs.Variables import TT_pdfs
|
|
from AFM_thumbs.Variables import TT_subdirs
|
|
from AFM_thumbs.Variables import TT_png
|
|
from AFM_thumbs.Variables import TT_spektral
|
|
from AFM_thumbs.Variables import TT_peek
|
|
from AFM_thumbs.Variables import TT_minimum_on_zero
|
|
from AFM_thumbs.Variables import SPECS_Nanonis_images_must_exist
|
|
from AFM_thumbs.Variables import SPECS_Nanonis_spectroscopy_must_exist
|
|
from AFM_thumbs.Variables import Nanotec_DULCINEA_must_exist
|
|
from AFM_thumbs.Variables import Omicron_SCALA_must_exist
|
|
from AFM_thumbs.Variables import RHK_must_exist
|
|
from AFM_thumbs.Variables import globvar_color_options
|
|
from AFM_thumbs.Variables import globvar_ttk_Combobox
|
|
from AFM_thumbs.Variables import globvar_fonts
|
|
from AFM_thumbs.Variables import globvar_bad_fonts
|
|
from AFM_thumbs.ToolTip import create_tool_tip
|
|
from AFM_thumbs.Channel import define_color
|
|
from AFM_thumbs.PDF import prepare_PDFs
|
|
from AFM_thumbs.Initialize import initialize_dir
|
|
from AFM_thumbs.Initialize import initialize_position_counter
|
|
from AFM_thumbs.Initialize import initialize_check_config
|
|
from AFM_thumbs.SPECS_Nanonis import is_SPECS_Nanonis_file
|
|
from AFM_thumbs.SPECS_Nanonis import read_SPECS_Nanonis_image_data
|
|
from AFM_thumbs.SPECS_Nanonis import prepare_SPECS_Nanonis_images
|
|
from AFM_thumbs.SPECS_Nanonis import prepare_SPECS_Nanonis_spectra_curves
|
|
from AFM_thumbs.Omicron_SCALA import is_omicron_SCALA_file
|
|
from AFM_thumbs.Omicron_SCALA import read_Omicron_SCALA_data
|
|
from AFM_thumbs.Omicron_SCALA import prepare_Omicron_SCALA_images
|
|
from AFM_thumbs.Omicron_SCALA import prepare_Omicron_SCALA_spectra_curves
|
|
from AFM_thumbs.Nanotec_DULCINEA import is_Nanotec_DULCINEA_file
|
|
from AFM_thumbs.Nanotec_DULCINEA import prepare_Nanotec_DULCINEA_images
|
|
from AFM_thumbs.RHK import is_RHK_file
|
|
from AFM_thumbs.RHK import read_RHK_data
|
|
from AFM_thumbs.Command_line import command_line
|
|
from AFM_thumbs.Colour import plot_color_gradients
|
|
|
|
|
|
# This is the definition, where the calculation starts. The respective Python
|
|
# modules of the SPM file formats are called for each image, which is indeed an
|
|
# SPM image.
|
|
def start_with_calculations():
|
|
|
|
if not initialize_dir():
|
|
return False
|
|
|
|
# __________________________ SPECS Nanonis
|
|
|
|
# Find all SPECS Nanonis spectroscopy files in the directory
|
|
files = filter(lambda x: x.endswith(SPECS_Nanonis_spectroscopy_must_exist),
|
|
os.listdir(globvar_AFMdir.working_directory))
|
|
files = sorted(files)
|
|
|
|
if files != []:
|
|
print(globvar_spaces +
|
|
" ... SPECS Nanonis spectras are stored as thumbs ...")
|
|
for AFMfile in files:
|
|
if not AFMfile[0] == ".":
|
|
if globvar_ThumbPara.filename != "":
|
|
if re.search(globvar_ThumbPara.filename, AFMfile):
|
|
prepare_SPECS_Nanonis_spectra_curves(AFMfile)
|
|
else:
|
|
prepare_SPECS_Nanonis_spectra_curves(AFMfile)
|
|
|
|
|
|
# Find all SPECS Nanonis image files in the directory
|
|
files = filter(lambda x: x.endswith(SPECS_Nanonis_images_must_exist),
|
|
os.listdir(globvar_AFMdir.working_directory))
|
|
files = sorted(files)
|
|
|
|
if files != []:
|
|
print(globvar_spaces +
|
|
" ... SPECS Nanonis images are stored as thumbs ...")
|
|
for AFMfile in files:
|
|
if not AFMfile[0] == ".":
|
|
if globvar_ThumbPara.filename != "":
|
|
if re.search(globvar_ThumbPara.filename, AFMfile):
|
|
data_offset = read_SPECS_Nanonis_image_data(AFMfile)
|
|
prepare_SPECS_Nanonis_images(AFMfile, data_offset)
|
|
else:
|
|
data_offset = read_SPECS_Nanonis_image_data(AFMfile)
|
|
prepare_SPECS_Nanonis_images(AFMfile, data_offset)
|
|
|
|
|
|
|
|
# __________________________ Omicron SCALA
|
|
|
|
# Find all .par files in the directory
|
|
files = filter(lambda x: x.endswith(Omicron_SCALA_must_exist),
|
|
os.listdir(globvar_AFMdir.working_directory))
|
|
files = sorted(files)
|
|
|
|
if files != []:
|
|
if globvar_ThumbPara.spektra == 1:
|
|
print(globvar_spaces +
|
|
" ... Omicron SCALA spectra are stored as thumbs ...")
|
|
for AFMfile in files:
|
|
if not AFMfile[0] == ".":
|
|
if globvar_ThumbPara.filename != "":
|
|
if re.search(globvar_ThumbPara.filename, AFMfile):
|
|
read_Omicron_SCALA_data(AFMfile)
|
|
prepare_Omicron_SCALA_spectra_curves(AFMfile)
|
|
else:
|
|
read_Omicron_SCALA_data(AFMfile)
|
|
prepare_Omicron_SCALA_spectra_curves(AFMfile)
|
|
|
|
if files != []:
|
|
print(globvar_spaces +
|
|
" ... Omicron SCALA images are stored as thumbs ...")
|
|
for AFMfile in files:
|
|
if not AFMfile[0] == ".":
|
|
if globvar_ThumbPara.filename != "":
|
|
if re.search(globvar_ThumbPara.filename, AFMfile):
|
|
read_Omicron_SCALA_data(AFMfile)
|
|
prepare_Omicron_SCALA_images(AFMfile)
|
|
else:
|
|
read_Omicron_SCALA_data(AFMfile)
|
|
prepare_Omicron_SCALA_images(AFMfile)
|
|
|
|
# __________________________ Nanotec DULCINEA
|
|
|
|
# Find all .f.top files in the directory
|
|
files = filter(lambda x: x.endswith(Nanotec_DULCINEA_must_exist),
|
|
os.listdir(globvar_AFMdir.working_directory))
|
|
files = sorted(files)
|
|
|
|
if files != []:
|
|
print(globvar_spaces +
|
|
" ... Nanotec DULCINEA images are stored as thumbs ...")
|
|
for AFMfile in files:
|
|
if not AFMfile[0] == ".":
|
|
if globvar_ThumbPara.filename != "":
|
|
if re.search(globvar_ThumbPara.filename,AFMfile):
|
|
prepare_Nanotec_DULCINEA_images(AFMfile)
|
|
else:
|
|
prepare_Nanotec_DULCINEA_images(AFMfile)
|
|
|
|
|
|
# __________________________ RHK
|
|
|
|
# Find all .SM4 and .sm4 files in the directory
|
|
files_1 = filter(lambda x: x.endswith(RHK_must_exist[0]),
|
|
os.listdir(globvar_AFMdir.working_directory))
|
|
|
|
# To be verified if it works, C. Barth 2022-02-17
|
|
files_2 = filter(lambda x: x.endswith(RHK_must_exist[1]),
|
|
os.listdir(globvar_AFMdir.working_directory))
|
|
files = sorted(list(files_1) + list(files_2))
|
|
|
|
if files != []:
|
|
initialize_position_counter()
|
|
|
|
# Note that the creation of the thumbnails for spectra is done inside
|
|
# read_RHK_data!
|
|
print(globvar_spaces + " ... RHK images and are stored as thumbs ...")
|
|
for AFMfile in files:
|
|
if not AFMfile[0] == ".":
|
|
if globvar_ThumbPara.filename != "":
|
|
if re.search(globvar_ThumbPara.filename,AFMfile):
|
|
read_RHK_data(AFMfile)
|
|
else:
|
|
read_RHK_data(AFMfile)
|
|
# __________________________ Prepare pdfs
|
|
|
|
print(globvar_spaces + " ... pdfs are built ...")
|
|
print
|
|
|
|
prepare_PDFs()
|
|
|
|
return True
|
|
|
|
# ____________________________________________________ Start calculating images
|
|
|
|
|
|
# This is basically the definition, where the images are searched in the
|
|
# working directory. The definition 'start_with_calculations()' (see above) is
|
|
# then called.
|
|
def initialize_and_go(directory_start, config_file):
|
|
|
|
# Here the last note for the AFM_thumbs header that is shown in the console.
|
|
# The config file will be printed.
|
|
if config_file is not None:
|
|
config_file_path = config_file
|
|
else:
|
|
config_file_path = os.path.join(globvar_configfile_path,
|
|
globvar_configfile)
|
|
print(globvar_spaces +
|
|
"Config file: " +
|
|
config_file_path +
|
|
"\n\n")
|
|
|
|
list_tmp = []
|
|
initialize_linalg()
|
|
|
|
# Recursive directory search ... all subdirectories shall be considered.
|
|
# Option 'All-subdirectories' activated
|
|
if globvar_ThumbPara.subdirs == 1:
|
|
|
|
for directory, dirnames, filenames in os.walk(directory_start):
|
|
# Take only data, that is in a 'main' directory called, e.g.,
|
|
# 'sample'.
|
|
if globvar_ThumbPara.masterdir != "":
|
|
if globvar_ThumbPara.masterdir not in directory:
|
|
continue
|
|
|
|
# Are there Omicron, Nanotec, ... files?
|
|
list_tmp += is_SPECS_Nanonis_file(directory, filenames)
|
|
list_tmp += is_omicron_SCALA_file(directory, filenames)
|
|
list_tmp += is_Nanotec_DULCINEA_file(directory, filenames)
|
|
list_tmp += is_RHK_file(directory, filenames)
|
|
|
|
# Sort the directory list
|
|
list_directories = sorted(list_tmp)
|
|
|
|
print(globvar_spaces + "Directories that will be considered:")
|
|
for directory in list_directories:
|
|
print(globvar_spaces + directory)
|
|
print("\n\n")
|
|
for directory in list_directories:
|
|
print(globvar_spaces + " I'm working in the directory\n" +
|
|
globvar_spaces + " " + directory + "\n" +
|
|
globvar_spaces + " right now ...\n")
|
|
globvar_AFMdir.working_directory = directory
|
|
start_with_calculations()
|
|
|
|
# Only one directory is considered. Option 'All-subdirectories' is
|
|
# deactivated.
|
|
else:
|
|
globvar_AFMdir.working_directory = directory_start
|
|
list_dir = os.listdir(globvar_AFMdir.working_directory)
|
|
|
|
list_tmp = []
|
|
list_tmp += is_SPECS_Nanonis_file(directory, filenames)
|
|
list_tmp += is_omicron_SCALA_file(directory_start, list_dir)
|
|
list_tmp += is_Nanotec_DULCINEA_file(directory_start, list_dir)
|
|
list_tmp += is_RHK_file(directory_start, list_dir)
|
|
|
|
# Finally: the routine is called
|
|
if list_tmp != []:
|
|
start_with_calculations()
|
|
|
|
|
|
# _____________________________________________________________ Tkinter Windows
|
|
|
|
|
|
class MyDialog(Frame):
|
|
|
|
def __init__(self, master):
|
|
|
|
'''
|
|
Initialisation Method
|
|
'''
|
|
|
|
self.op_sys = platform.system()
|
|
self.working_directory = ""
|
|
self.pdf_path = ""
|
|
self.filepath_config = initialize_check_config(None)
|
|
self.mainWindow = Frame(master)
|
|
Frame.__init__(self,master)
|
|
self.master.title(globvar_bar_title)
|
|
self.createWidgets()
|
|
|
|
def createWidgets(self):
|
|
|
|
'''
|
|
Method for creating all GUI specific components
|
|
'''
|
|
|
|
master = self.master
|
|
|
|
# Extra Frame for the following frames so it will not shift
|
|
# the formating
|
|
self.frameLeft = Frame(self.master)
|
|
self.frameLeft.grid(row=1, column=0, columnspan=6, sticky=W+E+N+S)
|
|
|
|
# Arangement of images
|
|
|
|
Label(self.frameLeft, text=" ").grid(row=0, sticky=W)
|
|
Label(self.frameLeft,
|
|
text="Arrangement of images",
|
|
fg="blue").grid(row=1, sticky=W)
|
|
|
|
Label(self.frameLeft,
|
|
text="No. of images in column").grid(row=2, column=0, sticky=W)
|
|
self.n_col = Entry(self.frameLeft, width=3)
|
|
self.n_col.delete(0, END)
|
|
self.n_col.grid(row=2, column=1)
|
|
self.n_col.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="No. of images in row").grid(row=3, column=0, sticky=W)
|
|
self.n_row = Entry(self.frameLeft, width=3)
|
|
self.n_row.delete(0, END)
|
|
self.n_row.grid(row=3, column=1)
|
|
self.n_row.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="Contrast").grid(row=4, column=0, sticky=W)
|
|
self.rms = Entry(self.frameLeft, width=3)
|
|
self.rms.delete(0, END)
|
|
self.rms.grid(row=4, column=1)
|
|
self.rms.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="Image resolution").grid(row=5, column=0, sticky=W)
|
|
self.res = Entry(self.frameLeft, width=3)
|
|
self.res.delete(0, END)
|
|
self.res.grid(row=5, column=1)
|
|
self.res.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="Image quality").grid(row=6, column=0, sticky=W)
|
|
self.jpeg = Entry(self.frameLeft, width=3)
|
|
self.jpeg.delete(0, END)
|
|
self.jpeg.grid(row=6, column=1)
|
|
self.jpeg.bind("<Return>", self.lost_focus)
|
|
|
|
# Position/size of body text
|
|
|
|
Label(self.frameLeft,
|
|
text=" ").grid(row=8, sticky=W)
|
|
|
|
Label(self.frameLeft,
|
|
text="Position/size of body text",
|
|
fg="blue").grid(row=8, column=0, sticky=W)
|
|
|
|
Label(self.frameLeft,
|
|
text="Font size").grid(row=9, column=0, sticky=W)
|
|
self.text_size = Entry(self.frameLeft, width=4)
|
|
self.text_size.delete(0, END)
|
|
self.text_size.grid(row=9, column=1)
|
|
self.text_size.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="dX position").grid(row=10, column=0, sticky=W)
|
|
self.text_x = Entry(self.frameLeft, width=4)
|
|
self.text_x.delete(0, END)
|
|
self.text_x.grid(row=10, column=1)
|
|
self.text_x.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="dY position").grid(row=11, column=0, sticky=W)
|
|
self.text_y = Entry(self.frameLeft, width=4)
|
|
self.text_y.delete(0, END)
|
|
self.text_y.grid(row=11, column=1)
|
|
self.text_y.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="dWidth of text").grid(row=12, column=0, sticky=W)
|
|
self.text_block = Entry(self.frameLeft, width=4)
|
|
self.text_block.delete(0, END)
|
|
self.text_block.grid(row=12, column=1)
|
|
self.text_block.bind("<Return>", self.lost_focus)
|
|
|
|
# Select font
|
|
Label(self.frameLeft,
|
|
text="Select font").grid(row=14, column=0, sticky=W)
|
|
self.fonts = self.get_fonts()
|
|
self.font_menu_var = StringVar()
|
|
self.font_menu = ttk.Combobox(self.frameLeft,
|
|
textvariable=self.font_menu_var,
|
|
values=self.fonts,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.font_menu.grid(row=14, column=1, sticky=W)
|
|
self.font_menu.current(0) # set selection
|
|
self.font_menu.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
|
|
# File Options
|
|
|
|
Label(self.frameLeft,
|
|
text="File suffix").grid(row=16, column=0, sticky=W)
|
|
self.extension = Entry(self.frameLeft, width=10)
|
|
self.extension.delete(0, END)
|
|
self.extension.grid(row=16, column=1)
|
|
self.extension.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="Path contains").grid(row=17, column=0, sticky=W)
|
|
self.masterdir = Entry(self.frameLeft, width=10)
|
|
self.masterdir.delete(0, END)
|
|
self.masterdir.grid(row=17, column=1)
|
|
self.masterdir.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft,
|
|
text="File name contains").grid(row=18, column=0, sticky=W)
|
|
self.filename = Entry(self.frameLeft, width=10)
|
|
self.filename.delete(0, END)
|
|
self.filename.grid(row=18, column=1)
|
|
self.filename.bind("<Return>", self.lost_focus)
|
|
|
|
Label(self.frameLeft, text=" ").grid(column=2, sticky=W)
|
|
|
|
# Parameters of measurements
|
|
|
|
Label(self.frameLeft,
|
|
text=" Parameters of measurements",
|
|
fg="blue").grid(row=1, column=3, columnspan=2, sticky=W)
|
|
|
|
self.date_var = IntVar()
|
|
self.date = Checkbutton(self.frameLeft,
|
|
text=" Date and time",
|
|
variable=self.date_var)
|
|
self.date.grid(row=2, column=3, sticky=W)
|
|
|
|
self.sizenm_var = IntVar()
|
|
self.sizenm = Checkbutton(self.frameLeft,
|
|
text=" Size (nm)",
|
|
variable=self.sizenm_var)
|
|
self.sizenm.grid(row=3, column=3, sticky=W)
|
|
|
|
self.sizepx_var = IntVar()
|
|
self.sizepx = Checkbutton(self.frameLeft,
|
|
text=" Size (pixel)",
|
|
variable=self.sizepx_var)
|
|
self.sizepx.grid(row=4, column=3, sticky=W)
|
|
|
|
self.offset_var = IntVar()
|
|
self.offset = Checkbutton(self.frameLeft,
|
|
text=" Offset",
|
|
variable=self.offset_var)
|
|
self.offset.grid(row=5, column=3, sticky=W)
|
|
|
|
self.voltage_var = IntVar()
|
|
self.voltage = Checkbutton(self.frameLeft,
|
|
text=" Voltage",
|
|
variable=self.voltage_var)
|
|
self.voltage.grid(row=6, column=3, sticky=W)
|
|
|
|
self.feedback_var = IntVar()
|
|
self.feedback = Checkbutton(self.frameLeft,
|
|
text=" Feedback",
|
|
variable=self.feedback_var)
|
|
self.feedback.grid(row=2, column=4, sticky=W)
|
|
|
|
self.gain_var = IntVar()
|
|
self.gain = Checkbutton(self.frameLeft,
|
|
text=" Loop gain",
|
|
variable=self.gain_var)
|
|
self.gain.grid(row=3, column=4, sticky=W)
|
|
|
|
self.speed_var = IntVar()
|
|
self.speed = Checkbutton(self.frameLeft,
|
|
text=" Speed",
|
|
variable=self.speed_var)
|
|
self.speed.grid(row=4, column=4, sticky=W)
|
|
|
|
self.ampl_var = IntVar()
|
|
self.ampl = Checkbutton(self.frameLeft,
|
|
text=" Amplitude ",
|
|
variable=self.ampl_var)
|
|
self.ampl.grid(row=5, column=4, sticky=W)
|
|
|
|
self.angle_var = IntVar()
|
|
self.angle = Checkbutton(self.frameLeft,
|
|
text=" Angle ",
|
|
variable=self.angle_var)
|
|
self.angle.grid(row=6, column=4, sticky=W)
|
|
|
|
# Other options
|
|
|
|
Label(self.frameLeft,
|
|
text=" Other options", fg="blue").grid(row=8,column=3,sticky=W)
|
|
|
|
self.thumbs_before_var = IntVar()
|
|
self.thumbs_before = Checkbutton(self.frameLeft,
|
|
text=" Delete before",
|
|
variable=self.thumbs_before_var)
|
|
self.thumbs_before.grid(row=9, column=3, sticky=W)
|
|
|
|
self.thumbs_after_var = IntVar()
|
|
self.thumbs_after = Checkbutton(self.frameLeft,
|
|
text=" Delete after",
|
|
variable=self.thumbs_after_var)
|
|
self.thumbs_after.grid(row=10, column=3, sticky=W)
|
|
|
|
self.extra_directories_var = IntVar()
|
|
self.extra_directories = Checkbutton(self.frameLeft,
|
|
text=" Extra dir",
|
|
variable= \
|
|
self.extra_directories_var)
|
|
self.extra_directories.grid(row=11, column=3, sticky=W)
|
|
|
|
self.pdfs_var = IntVar()
|
|
self.pdfs = Checkbutton(self.frameLeft,
|
|
text=" Replace pdfs",
|
|
variable=self.pdfs_var)
|
|
self.pdfs.grid(row=12, column=3, sticky=W)
|
|
|
|
self.subdirs_var = IntVar()
|
|
self.subdirs = Checkbutton(self.frameLeft,
|
|
text=" All sub dirs",
|
|
variable=self.subdirs_var)
|
|
self.subdirs.grid(row=13, column=3, sticky=W)
|
|
|
|
self.format_var = IntVar()
|
|
self.format = Checkbutton(self.frameLeft,
|
|
text=" PNG/JPEG",
|
|
variable=self.format_var)
|
|
self.format.grid(row=9, column=4, sticky=W)
|
|
|
|
self.skala_var = IntVar()
|
|
self.skala = Checkbutton(self.frameLeft,
|
|
text=" Spectro",
|
|
variable=self.skala_var)
|
|
self.skala.grid(row=10, column=4, sticky=W)
|
|
|
|
self.peek_var = IntVar()
|
|
self.peek = Checkbutton(self.frameLeft,
|
|
text=" Peak-peak",
|
|
variable=self.peek_var)
|
|
self.peek.grid(row=11, column=4, sticky=W)
|
|
|
|
self.minimum_on_zero_var = IntVar()
|
|
self.minimum_on_zero = Checkbutton(self.frameLeft,
|
|
text=" Min on 0",
|
|
variable=self.minimum_on_zero_var)
|
|
self.minimum_on_zero.grid(row=12, column=4, sticky=W)
|
|
|
|
# Hide Tooltips
|
|
|
|
Label(self.frameLeft, text=" ").grid(column=5, sticky=W)
|
|
|
|
|
|
Label(self.frameLeft,
|
|
text="Hide Tool-tips", fg="blue").grid(row=16,
|
|
column=3,
|
|
sticky=W)
|
|
|
|
self.tooltip_var = IntVar()
|
|
|
|
self.show_tipps = Radiobutton(self.frameLeft,
|
|
text="Show",
|
|
variable=self.tooltip_var,
|
|
value=0, command=self.sh_tooltips)
|
|
self.show_tipps.grid(row=17, column=3, sticky=W)
|
|
|
|
self.hide_tipps = Radiobutton(self.frameLeft,
|
|
text="Hide",
|
|
variable=self.tooltip_var,
|
|
value=1,
|
|
command=self.no_tooltips)
|
|
self.hide_tipps.grid(row=17, column=4, sticky=W)
|
|
|
|
# Select Radiobuttons
|
|
|
|
Label(self.frameLeft,
|
|
text="Select thumbs", fg="blue").grid(row=1,
|
|
column=6,
|
|
sticky=W)
|
|
|
|
self.thumbs_var = IntVar()
|
|
|
|
self.thumbs_all = Radiobutton(self.frameLeft,
|
|
text="All",
|
|
variable=self.thumbs_var,
|
|
value=0,
|
|
command=self.select_thumbs_all)
|
|
self.thumbs_all.grid(row=2, column=6, sticky=W)
|
|
|
|
self.thumbs_for = Radiobutton(self.frameLeft,
|
|
text="Forward",
|
|
variable=self.thumbs_var,
|
|
value=1,
|
|
command=self.select_thumbs_for)
|
|
self.thumbs_for.grid(row=3, column=6, sticky=W)
|
|
|
|
self.thumbs_back = Radiobutton(self.frameLeft,
|
|
text="Backward",
|
|
variable=self.thumbs_var,
|
|
value=2,
|
|
command=self.select_thumbs_back)
|
|
self.thumbs_back.grid(row=4, column=6, sticky=W)
|
|
|
|
self.thumbs_none = Radiobutton(self.frameLeft,
|
|
text="None",
|
|
variable=self.thumbs_var,
|
|
value=3,
|
|
command=self.select_thumbs_none)
|
|
self.thumbs_none.grid(row=5, column=6, sticky=W)
|
|
|
|
|
|
Label(self.frameLeft,
|
|
text="Select line fit",
|
|
fg="blue").grid(row=6, column=6, sticky=W)
|
|
|
|
self.lin_var = IntVar()
|
|
|
|
self.lin_all = Radiobutton(self.frameLeft,
|
|
text="All",
|
|
variable=self.lin_var,
|
|
value=0,
|
|
command=self.select_lin_all)
|
|
self.lin_all.grid(row=7, column=6, sticky=W)
|
|
|
|
self.lin_for = Radiobutton(self.frameLeft,
|
|
text="Forward",
|
|
variable=self.lin_var,
|
|
value=1,
|
|
command=self.select_lin_for)
|
|
self.lin_for.grid(row=8, column=6, sticky=W)
|
|
|
|
self.lin_back = Radiobutton(self.frameLeft,
|
|
text="Backward",
|
|
variable=self.lin_var,
|
|
value=2,
|
|
command=self.select_lin_back)
|
|
self.lin_back.grid(row=9, column=6, sticky=W)
|
|
|
|
self.lin_none = Radiobutton(self.frameLeft,
|
|
text="None",
|
|
variable=self.lin_var,
|
|
value=3,
|
|
command=self.select_lin_none)
|
|
self.lin_none.grid(row=10, column=6, sticky=W)
|
|
|
|
Label(self.frameLeft,
|
|
text="Select plane fit",
|
|
fg="blue").grid(row=11, column=6, sticky=W)
|
|
|
|
self.plane_var = IntVar()
|
|
|
|
self.plane_all = Radiobutton(self.frameLeft,
|
|
text="All",
|
|
variable=self.plane_var,
|
|
value=0,
|
|
command=self.select_plane_all)
|
|
self.plane_all.grid(row=12, column=6, sticky=W)
|
|
|
|
self.plane_for = Radiobutton(self.frameLeft,
|
|
text="Forward",
|
|
variable=self.plane_var,
|
|
value=1,
|
|
command=self.select_plane_for)
|
|
self.plane_for.grid(row=13, column=6, sticky=W)
|
|
|
|
self.plane_back = Radiobutton(self.frameLeft,
|
|
text="Backward",
|
|
variable=self.plane_var,
|
|
value=2,
|
|
command=self.select_plane_back)
|
|
self.plane_back.grid(row=14, column=6, sticky=W)
|
|
|
|
self.plane_none = Radiobutton(self.frameLeft,
|
|
text="None",
|
|
variable=self.plane_var,
|
|
value=3,
|
|
command=self.select_plane_none)
|
|
self.plane_none.grid(row=15, column=6, sticky=W)
|
|
|
|
|
|
Label(self.frameLeft,
|
|
text="Select inversion",
|
|
fg="blue").grid(row=16, column=6, sticky=W)
|
|
|
|
self.invert_var = IntVar()
|
|
|
|
self.invert_all = Radiobutton(self.frameLeft,
|
|
text="All",
|
|
variable=self.invert_var,
|
|
value=0,
|
|
command=self.select_invert_all)
|
|
self.invert_all.grid(row=17, column=6, sticky=W)
|
|
|
|
self.invert_for = Radiobutton(self.frameLeft,
|
|
text="Forward",
|
|
variable=self.invert_var,
|
|
value=1,
|
|
command=self.select_invert_for)
|
|
self.invert_for.grid(row=18, column=6, sticky=W)
|
|
|
|
self.invert_back = Radiobutton(self.frameLeft,
|
|
text="Backward",
|
|
variable=self.invert_var,
|
|
value=2,
|
|
command=self.select_invert_back)
|
|
self.invert_back.grid(row=19, column=6, sticky=W)
|
|
|
|
self.invert_none = Radiobutton(self.frameLeft,
|
|
text="None",
|
|
variable=self.invert_var,
|
|
value=3,
|
|
command=self.select_invert_none)
|
|
self.invert_none.grid(row=20, column=6, sticky=W)
|
|
|
|
Label(self.frameLeft,
|
|
text="", width=5).grid(column=7, sticky=W)
|
|
|
|
# Channel Options
|
|
|
|
# Extra Frame for the following frames so it will not shift
|
|
# the formating.
|
|
self.frameUber = Frame(self.master)
|
|
self.frameUber.grid(row=1, column=7, columnspan=6, sticky=W+E+N+S)
|
|
|
|
# Frame for Channel List
|
|
self.frameOne = Frame(self.frameUber)
|
|
self.frameOne.grid(row=0, column=0, sticky=W+E+N+S)
|
|
Label(self.frameOne, text=" ").grid(row=0, sticky=W)
|
|
|
|
# List for saving the references of all Var-Objects
|
|
self.name_list = []
|
|
self.thumb_list = []
|
|
self.linefit_list = []
|
|
self.planefit_list = []
|
|
self.invert_list = []
|
|
self.color_list = []
|
|
|
|
# Set Width of columns
|
|
Label(self.frameOne, text="", width=12).grid(row=1,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.frameOne, text="", width=8).grid(row=1,
|
|
column=1,
|
|
sticky=W)
|
|
Label(self.frameOne, text="", width=8).grid(row=1,
|
|
column=2,
|
|
sticky=W)
|
|
Label(self.frameOne, text="", width=8).grid(row=1,
|
|
column=3,
|
|
sticky=W)
|
|
Label(self.frameOne, text="", width=6).grid(row=1,
|
|
column=4,
|
|
sticky=W)
|
|
|
|
# Captions, labels and direction arrows in frameOne
|
|
Label(self.frameOne, text="Channel", fg="blue").grid(row=1,
|
|
column=0,
|
|
sticky=W)
|
|
|
|
Label(self.frameOne, text="Topography").grid(row=2, column=0, sticky=W)
|
|
Label(self.frameOne, text="Topography").grid(row=3, column=0, sticky=W)
|
|
Label(self.frameOne, text="df").grid(row=4, column=0, sticky=W)
|
|
Label(self.frameOne, text="df").grid(row=5, column=0, sticky=W)
|
|
Label(self.frameOne, text="Dissipation").grid(row=7, column=0,sticky=W)
|
|
Label(self.frameOne, text="Dissipation").grid(row=8, column=0,sticky=W)
|
|
Label(self.frameOne, text="Amplitude").grid(row=9, column=0, sticky=W)
|
|
Label(self.frameOne, text="Amplitude").grid(row=10, column=0, sticky=W)
|
|
|
|
self.name_list.append("Topography")
|
|
self.name_list.append("df")
|
|
self.name_list.append("Dissipation")
|
|
self.name_list.append("Amplitude")
|
|
|
|
Label(self.frameOne, text="", width=10).grid(row=1, column=1, sticky=W)
|
|
Label(self.frameOne, text="Direction", fg="blue").grid(row=1,
|
|
column=1,
|
|
sticky=W+S)
|
|
|
|
Label(self.frameOne, text=" --->").grid(row=2, column=1, sticky=W+S)
|
|
Label(self.frameOne, text=" <---").grid(row=3, column=1, sticky=W)
|
|
Label(self.frameOne, text=" --->").grid(row=4, column=1, sticky=W)
|
|
Label(self.frameOne, text=" <---").grid(row=5, column=1, sticky=W)
|
|
Label(self.frameOne, text=" --->").grid(row=7, column=1, sticky=W)
|
|
Label(self.frameOne, text=" <---").grid(row=8, column=1, sticky=W)
|
|
Label(self.frameOne, text=" --->").grid(row=9, column=1, sticky=W)
|
|
Label(self.frameOne, text=" <---").grid(row=10, column=1, sticky=W)
|
|
|
|
Label(self.frameOne, text="", width=10).grid(row=1,
|
|
column=2,
|
|
sticky=W)
|
|
Label(self.frameOne, text="Thumb", fg="blue").grid(row=1,
|
|
column=2,
|
|
sticky=W+S)
|
|
|
|
Label(self.frameOne, text="", width=10).grid(row=1, column=3, sticky=W)
|
|
Label(self.frameOne, text="Line fit", fg="blue").grid(row=1,
|
|
column=3,
|
|
sticky=W+S)
|
|
|
|
Label(self.frameOne, text="", width=10).grid(row=1,
|
|
column=4,
|
|
sticky=W)
|
|
Label(self.frameOne, text="Plane fit", fg="blue").grid(row=1,
|
|
column=4,
|
|
sticky=W+S)
|
|
|
|
Label(self.frameOne, text="", width=10).grid(row=1,
|
|
column=5,
|
|
sticky=W)
|
|
Label(self.frameOne, text="Inversion", fg="blue").grid(row=1,
|
|
column=5,
|
|
sticky=W+S)
|
|
|
|
Label(self.frameOne, text="", width=6).grid(row=1,
|
|
column=6,
|
|
sticky=W)
|
|
Label(self.frameOne, text="Color map", fg="blue").grid(row=1,
|
|
column=6,
|
|
sticky=W+S)
|
|
|
|
# Loop for creating the Checkboxs and the Color Options in frameOne
|
|
|
|
# Variables for loop
|
|
self.rowcounter = 2
|
|
self.addspace = 0
|
|
|
|
while self.rowcounter < 11:
|
|
|
|
self.thumbs_temp_var = IntVar()
|
|
self.thumbs_temp = Checkbutton(self.frameOne,
|
|
text="",
|
|
variable=self.thumbs_temp_var,
|
|
command=self.deselect_met)
|
|
|
|
self.thumbs_temp.grid(row=self.rowcounter, column=2, sticky=W)
|
|
self.thumb_list.append(self.thumbs_temp_var)
|
|
|
|
self.line_fit_temp_var = IntVar()
|
|
self.line_fit_temp = Checkbutton(self.frameOne,
|
|
text="",
|
|
variable=self.line_fit_temp_var,
|
|
command=self.select_met)
|
|
|
|
self.line_fit_temp.grid(row=self.rowcounter, column=3, sticky=W)
|
|
|
|
self.linefit_list.append(self.line_fit_temp_var)
|
|
|
|
self.plane_fit_temp_var = IntVar()
|
|
self.plane_fit_temp = Checkbutton(self.frameOne,
|
|
text="",
|
|
variable=self.plane_fit_temp_var,
|
|
command=self.select_met)
|
|
|
|
self.plane_fit_temp.grid(row=self.rowcounter, column=4, sticky=W)
|
|
|
|
self.planefit_list.append(self.plane_fit_temp_var)
|
|
|
|
self.invert_temp_var = IntVar()
|
|
self.invert_temp = Checkbutton(self.frameOne,
|
|
text="",
|
|
variable=self.invert_temp_var,
|
|
command=self.select_met)
|
|
|
|
self.invert_temp.grid(row=self.rowcounter, column=5, sticky=W)
|
|
|
|
self.invert_list.append(self.invert_temp_var)
|
|
|
|
self.color_menu_var = StringVar()
|
|
self.color_menu = ttk.Combobox(self.frameOne,
|
|
textvariable=self.color_menu_var,
|
|
values=globvar_color_options,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.color_menu.grid(row=self.rowcounter,
|
|
column=6,
|
|
sticky=W)
|
|
self.color_menu.current(0)
|
|
self.color_menu.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
|
|
self.color_list.append(self.color_menu_var)
|
|
|
|
self.rowcounter += 1
|
|
self.addspace += 1
|
|
|
|
if self.addspace == 4:
|
|
self.addspace = 0
|
|
Label(self.frameOne, text=" ").grid(row=self.rowcounter,
|
|
sticky=W)
|
|
self.rowcounter += 1
|
|
|
|
self.frameTwo = Frame(self.frameUber)
|
|
self.frameTwo.grid(row=2, column=0, sticky=W)
|
|
|
|
# Creation of a new frame, inside of "frameTwo" for new fields
|
|
# Creation of a scrollbar
|
|
|
|
# The reason for this is to attach the scrollbar to "FrameTwo", and
|
|
# when the size of frame "ListFrame" exceeds the size of frameTwo,
|
|
# the scrollbar acts.
|
|
self.canvas=Canvas(self.frameTwo)
|
|
self.listFrame=Frame(self.canvas)
|
|
self.scrollb=Scrollbar(self.frameUber, orient="vertical",
|
|
command=self.canvas.yview)
|
|
# The grid scrollbar is in self.frameUber, but ...
|
|
self.scrollb.grid(row=2, column=1, sticky='nsew')
|
|
# ... attach the scrollbar to frameTwo.
|
|
self.canvas['yscrollcommand'] = self.scrollb.set
|
|
|
|
#
|
|
self.canvas.create_window((0,0),window=self.listFrame,anchor='nw')
|
|
self.listFrame.bind("<Configure>", self.AuxscrollFunction)
|
|
# Forget the scrollbar because the number of pieces remains undefined
|
|
# by the user. But do not destroy it. It will be "remembered" later.
|
|
self.scrollb.grid_forget()
|
|
|
|
self.canvas.pack(side="left")
|
|
self.frameThree = Frame(self.frameUber)
|
|
self.frameThree.grid(row=3, column=0)
|
|
|
|
self.AuxscrollFunction(event=None)
|
|
|
|
# Mousewheel binding
|
|
self.frameTwo.bind('<Enter>', self.activate_mousewheel)
|
|
self.frameTwo.bind('<Leave>', self.deactivate_mousewheel)
|
|
|
|
# Set Width of columns
|
|
|
|
Label(self.listFrame, text="", width=12).grid(row=1,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="", width=10).grid(row=1,
|
|
column=1,
|
|
sticky=W)
|
|
Label(self.listFrame, text="", width=10).grid(row=1,
|
|
column=2,
|
|
sticky=W)
|
|
Label(self.listFrame, text="", width=10).grid(row=1,
|
|
column=3,
|
|
sticky=W)
|
|
Label(self.listFrame, text="", width=10).grid(row=1,
|
|
column=4,
|
|
sticky=W)
|
|
Label(self.listFrame, text="", width=10).grid(row=1,
|
|
column=5,
|
|
sticky=W)
|
|
Label(self.listFrame, text="", width=6).grid(row=1,
|
|
column=6,
|
|
sticky=W)
|
|
|
|
Label(self.listFrame, text="Kelvin").grid(row=0,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Kelvin").grid(row=1,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Kelvin Error").grid(row=2,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Kelvin Error").grid(row=3,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Ext 1").grid(row=5,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Ext 1").grid(row=6,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Ext 2").grid(row=7,
|
|
column=0,
|
|
sticky=W)
|
|
Label(self.listFrame, text="Ext 2").grid(row=8,
|
|
column=0,
|
|
sticky=W)
|
|
|
|
# Captions, labels and directio arrows in listFrame
|
|
self.name_list.append("Kelvin")
|
|
self.name_list.append("Kelvin Error")
|
|
self.name_list.append("Ext 1")
|
|
self.name_list.append("Ext 2")
|
|
|
|
Label(self.listFrame, text=" --->").grid(row=0, column=1, sticky=W)
|
|
Label(self.listFrame, text=" <---").grid(row=1, column=1, sticky=W)
|
|
Label(self.listFrame, text=" --->").grid(row=2, column=1, sticky=W)
|
|
Label(self.listFrame, text=" <---").grid(row=3, column=1, sticky=W)
|
|
Label(self.listFrame, text=" --->").grid(row=5, column=1, sticky=W)
|
|
Label(self.listFrame, text=" <---").grid(row=6, column=1, sticky=W)
|
|
Label(self.listFrame, text=" --->").grid(row=7, column=1, sticky=W)
|
|
Label(self.listFrame, text=" <---").grid(row=8, column=1, sticky=W)
|
|
|
|
# Loop for creating the Checkboxs and the Color Options in listFrame
|
|
|
|
# Variables for loop
|
|
self.rowcounter = 0
|
|
self.addspace = 0
|
|
|
|
while self.rowcounter < 10:
|
|
|
|
self.thumbs_temp_var = IntVar()
|
|
self.thumbs_temp = Checkbutton(self.listFrame, text="",
|
|
variable=self.thumbs_temp_var,
|
|
command=self.deselect_met)
|
|
|
|
if self.rowcounter == 2:
|
|
self.thumbs_temp.grid(row=self.rowcounter, column=2,sticky=W+S)
|
|
else:
|
|
self.thumbs_temp.grid(row=self.rowcounter, column=2, sticky=W)
|
|
|
|
self.thumb_list.append(self.thumbs_temp_var)
|
|
|
|
self.line_fit_temp_var = IntVar()
|
|
self.line_fit_temp = Checkbutton(self.listFrame, text="",
|
|
variable=self.line_fit_temp_var,
|
|
command=self.select_met)
|
|
|
|
self.line_fit_temp.grid(row=self.rowcounter, column=3, sticky=W)
|
|
|
|
self.linefit_list.append(self.line_fit_temp_var)
|
|
|
|
self.plane_fit_temp_var = IntVar()
|
|
|
|
self.plane_fit_temp = Checkbutton(self.listFrame, text="",
|
|
variable=self.plane_fit_temp_var,
|
|
command=self.select_met)
|
|
|
|
self.plane_fit_temp.grid(row=self.rowcounter, column=4, sticky=W)
|
|
|
|
self.planefit_list.append(self.plane_fit_temp_var)
|
|
|
|
self.invert_temp_var = IntVar()
|
|
|
|
self.invert_temp = Checkbutton(self.listFrame, text="",
|
|
variable=self.invert_temp_var,
|
|
command=self.select_met)
|
|
|
|
self.invert_temp.grid(row=self.rowcounter, column=5, sticky=W)
|
|
|
|
self.invert_list.append(self.invert_temp_var)
|
|
|
|
self.color_menu_var = StringVar()
|
|
self.color_menu = ttk.Combobox(self.listFrame,
|
|
textvariable=self.color_menu_var,
|
|
values=globvar_color_options,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.color_menu.grid(row=self.rowcounter, column=6, sticky=W)
|
|
self.color_menu.current(0) # set selection
|
|
self.color_menu.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
|
|
self.color_list.append(self.color_menu_var)
|
|
|
|
self.rowcounter += 1
|
|
self.addspace += 1
|
|
|
|
if self.addspace == 4:
|
|
self.addspace = 0
|
|
Label(self.listFrame, text=" ").grid(row=self.rowcounter,
|
|
sticky=W)
|
|
self.rowcounter += 1
|
|
|
|
# Set counter of lines of FrameTwo
|
|
self.numChan = 15
|
|
|
|
# Remaining Buttons
|
|
self.button_dir = Button(master, text="Choose directory",
|
|
command=self.choose_dir)
|
|
self.button_dir.grid(row=2, column=0, sticky=W)
|
|
|
|
self.button_pdf_dir = Button(master, text="Choose pdf path",
|
|
command=self.pdf_path_select)
|
|
self.button_pdf_dir.grid(row=2, column=1, sticky=W)
|
|
|
|
self.button_run = Button(master, text="Run ...",
|
|
command=self.run_process)
|
|
self.button_run.grid(row=2, column=3, sticky=W)
|
|
|
|
self.button_default = Button(master, text="Default",
|
|
command=self.default)
|
|
self.button_default.grid(row=2, column=4)
|
|
|
|
self.button_info = Button(master, text="Info",
|
|
command=self.info)
|
|
self.button_info.grid(row=2, column=5)
|
|
|
|
self.button_colours = Button(master, text="Show colour maps",
|
|
command=self.show_colours)
|
|
self.button_colours.grid(row=2, column=8)
|
|
|
|
self.button_save = Button(master, text="Save configuration",
|
|
command=self.WriteConfigFile)
|
|
self.button_save.grid(row=2, column=10)
|
|
|
|
self.button_okay = Button(master, text="Save & exit",
|
|
command=self.done)
|
|
self.button_okay.grid(row=2, column=12, sticky=E)
|
|
|
|
# Read Config
|
|
self.ReadConfigFile()
|
|
|
|
def ReadConfigFile(self):
|
|
|
|
'''
|
|
Method for reading the Config File
|
|
takes over the values in the GUI
|
|
'''
|
|
|
|
# From here on, the parameters from the config file are stored into
|
|
# the variables.
|
|
config_file_p = open(self.filepath_config, "r")
|
|
|
|
# Read out if there are extra lines in the GUI
|
|
for line in config_file_p:
|
|
if "AddChannel" in line:
|
|
self.numChan = int(line[25:-1])
|
|
|
|
config_file_p.close()
|
|
|
|
# Create the extra lines
|
|
self.accept_parts()
|
|
|
|
config_file_p = open(self.filepath_config, "r")
|
|
|
|
# Go to parameters.
|
|
for line in config_file_p:
|
|
if "Parameters" in line:
|
|
break
|
|
|
|
channum = 0
|
|
# The whole config file is read
|
|
for line in config_file_p:
|
|
|
|
if "Rows" in line:
|
|
self.n_row.insert(0, line[25:-1])
|
|
continue
|
|
if "Columns" in line:
|
|
self.n_col.insert(0, line[25:-1])
|
|
continue
|
|
if "Rms" in line:
|
|
self.rms.insert(0, line[25:-1])
|
|
continue
|
|
if "Image resolution" in line:
|
|
self.res.insert(0, line[25:-1])
|
|
continue
|
|
if "Jpeg quality" in line:
|
|
self.jpeg.insert(0, line[25:-1])
|
|
continue
|
|
if "X text position" in line:
|
|
self.text_x.insert(0, line[25:-1])
|
|
continue
|
|
if "Y text position" in line:
|
|
self.text_y.insert(0, line[25:-1])
|
|
continue
|
|
if "Text size" in line:
|
|
self.text_size.insert(0, line[25:-1])
|
|
continue
|
|
if "Dx of text" in line:
|
|
self.text_block.insert(0, line[25:-1])
|
|
continue
|
|
if "Font" in line:
|
|
# It might be that the user is typing into the ASCII config
|
|
# file some font, which is not existing. So here, we have to
|
|
# check this. If the font is not existing a standard font is
|
|
# used instead
|
|
if line[25:-1] in self.fonts:
|
|
self.font_menu.set(line[25:-1])
|
|
continue
|
|
# if "Dy of text" in line:
|
|
# self.text_block_height.insert(0, line[25:-1])
|
|
if "Deleting thumbs before" in line:
|
|
if line[25:-1] == "1":
|
|
self.thumbs_before.select()
|
|
continue
|
|
if "Deleting thumbs after" in line:
|
|
if line[25:-1] == "1":
|
|
self.thumbs_after.select()
|
|
continue
|
|
if "Date" in line:
|
|
if line[25:-1] == "1":
|
|
self.date.select()
|
|
continue
|
|
if "Size in nm" in line:
|
|
if line[25:-1] == "1":
|
|
self.sizenm.select()
|
|
continue
|
|
if "Size in px" in line:
|
|
if line[25:-1] == "1":
|
|
self.sizepx.select()
|
|
continue
|
|
if "Offset" in line:
|
|
if line[25:-1] == "1":
|
|
self.offset.select()
|
|
continue
|
|
if "Voltage" in line:
|
|
if line[25:-1] == "1":
|
|
self.voltage.select()
|
|
continue
|
|
if "Feedback" in line:
|
|
if line[25:-1] == "1":
|
|
self.feedback.select()
|
|
continue
|
|
if "Gain" in line:
|
|
if line[25:-1] == "1":
|
|
self.gain.select()
|
|
continue
|
|
if "Speed" in line:
|
|
if line[25:-1] == "1":
|
|
self.speed.select()
|
|
continue
|
|
if "Amplitude" in line:
|
|
if line[25:-1] == "1":
|
|
self.ampl.select()
|
|
continue
|
|
if "Angle" in line:
|
|
if line[25:-1] == "1":
|
|
self.angle.select()
|
|
continue
|
|
if "Extra directories" in line:
|
|
if line[25:-1] == "1":
|
|
self.extra_directories.select()
|
|
continue
|
|
if "Subdirs" in line:
|
|
if line[25:-1] == "1":
|
|
self.subdirs.select()
|
|
continue
|
|
if "Spektral Options" in line:
|
|
if line[25:-1] == "1":
|
|
self.skala.select()
|
|
continue
|
|
if "Format Options" in line:
|
|
if line[25:-1] == "1":
|
|
self.format.select()
|
|
continue
|
|
if "Peek Options" in line:
|
|
if line[25:-1] == "1":
|
|
self.peek.select()
|
|
continue
|
|
if "Minimum on zero Options" in line:
|
|
if line[25:-1] == "1":
|
|
self.minimum_on_zero.select()
|
|
continue
|
|
if "File extension" in line:
|
|
self.extension.insert(0, line[25:-1])
|
|
continue
|
|
if "Master directory" in line:
|
|
self.masterdir.insert(0, line[25:-1])
|
|
continue
|
|
if "Filename" in line:
|
|
self.filename.insert(0, line[25:-1])
|
|
continue
|
|
if "Replace pdfs" in line:
|
|
if line[25:-1] == "1":
|
|
self.pdfs.select()
|
|
continue
|
|
if "Direction" in line:
|
|
if line[25:-1] == "0":
|
|
self.thumbs_all.select()
|
|
continue
|
|
if line[25:-1] == "1":
|
|
self.thumbs_for.select()
|
|
continue
|
|
if line[25:-1] == "2":
|
|
self.thumbs_back.select()
|
|
continue
|
|
if line[25:-1] == "3":
|
|
self.thumbs_none.select()
|
|
continue
|
|
if "Linefit" in line:
|
|
if line[25:-1] == "0":
|
|
self.lin_all.select()
|
|
continue
|
|
if line[25:-1] == "1":
|
|
self.lin_for.select()
|
|
continue
|
|
if line[25:-1] == "2":
|
|
self.lin_back.select()
|
|
continue
|
|
if line[25:-1] == "3":
|
|
self.lin_none.select()
|
|
continue
|
|
if "Planefit" in line:
|
|
if line[25:-1] == "0":
|
|
self.plane_all.select()
|
|
continue
|
|
if line[25:-1] == "1":
|
|
self.plane_for.select()
|
|
continue
|
|
if line[25:-1] == "2":
|
|
self.plane_back.select()
|
|
continue
|
|
if line[25:-1] == "3":
|
|
self.plane_none.select()
|
|
continue
|
|
if "Tooltips" in line:
|
|
if line[25:-1] == "0":
|
|
self.show_tipps.select()
|
|
self.sh_tooltips()
|
|
continue
|
|
if line[25:-1] == "1":
|
|
self.hide_tipps.select()
|
|
self.no_tooltips()
|
|
continue
|
|
|
|
if "ChannelNumber" in line:
|
|
channum = int(line[25:-1])
|
|
continue
|
|
|
|
for i in range(channum):
|
|
stri = "Channelname " + str(i+1) + " "
|
|
if stri in line:
|
|
self.name_list[i+8].set(line[25:-1])
|
|
|
|
for i in range(len(self.thumb_list)):
|
|
stri = "Thumb " + str(i+1) + " "
|
|
if stri in line:
|
|
if line[25:-1] == "1":
|
|
self.thumb_list[i].set(line[25:-1])
|
|
|
|
for i in range(len(self.linefit_list)):
|
|
stri = "LineFit " + str(i+1) + " "
|
|
if stri in line:
|
|
if line[25:-1] == "1":
|
|
self.linefit_list[i].set(line[25:-1])
|
|
|
|
for i in range(len(self.planefit_list)):
|
|
stri = "PlaneFit " + str(i+1) + " "
|
|
if stri in line:
|
|
if line[25:-1] == "1":
|
|
self.planefit_list[i].set(line[25:-1])
|
|
|
|
for i in range(len(self.invert_list)):
|
|
stri = "Inverted " + str(i+ 1) + " "
|
|
if stri in line:
|
|
if line[25:-1] == "1":
|
|
self.invert_list[i].set(line[25:-1])
|
|
|
|
for j in range(len(self.color_list)):
|
|
stri = "Color " + str(j+1) + " "
|
|
if stri in line:
|
|
self.color_list[j].set(line[25:-1])
|
|
|
|
config_file_p.close()
|
|
|
|
# change the Entry Objects in the Channel Frame to the new value
|
|
|
|
self.change_entry()
|
|
|
|
def WriteConfigFile(self):
|
|
|
|
'''
|
|
Method for saving the Config File
|
|
'''
|
|
|
|
# The parameters are first saved into a tmp file, which then replaces
|
|
# the config file.
|
|
|
|
file_tmp = self.filepath_config[:-5] + "_tmp.conf"
|
|
|
|
config_file_p = open(self.filepath_config, "r")
|
|
config_tmp_p = open(file_tmp, "w")
|
|
|
|
for line in config_file_p:
|
|
if "==========" in line:
|
|
config_tmp_p.write(line)
|
|
break
|
|
else:
|
|
config_tmp_p.write(line)
|
|
|
|
config_file_p.close()
|
|
|
|
config_tmp_p.write("Rows : "+
|
|
str(self.n_row.get())+"\n")
|
|
config_tmp_p.write("Columns : "+
|
|
str(self.n_col.get())+"\n")
|
|
config_tmp_p.write("Rms : "+
|
|
str(self.rms.get())+"\n")
|
|
config_tmp_p.write("Image resolution : "+
|
|
str(self.res.get())+"\n")
|
|
config_tmp_p.write("Jpeg quality : "+
|
|
str(self.jpeg.get())+"\n")
|
|
config_tmp_p.write("X text position : "+
|
|
str(self.text_x.get())+"\n")
|
|
config_tmp_p.write("Y text position : "+
|
|
str(self.text_y.get())+"\n")
|
|
config_tmp_p.write("Text size : "+
|
|
str(self.text_size.get())+"\n")
|
|
config_tmp_p.write("Dx of text : "+
|
|
str(self.text_block.get())+"\n")
|
|
config_tmp_p.write("Font : "+
|
|
str(self.font_menu.get())+"\n")
|
|
# config_tmp_p.write("Dy of text : "+
|
|
# str(self.text_block_height.get())+"\n")
|
|
config_tmp_p.write("Date : "+
|
|
str(self.date_var.get())+"\n")
|
|
config_tmp_p.write("Size in nm : "+
|
|
str(self.sizenm_var.get())+"\n")
|
|
config_tmp_p.write("Size in px : "+
|
|
str(self.sizepx_var.get())+"\n")
|
|
config_tmp_p.write("Offset : "+
|
|
str(self.offset_var.get())+"\n")
|
|
config_tmp_p.write("Voltage : "+
|
|
str(self.voltage_var.get())+"\n")
|
|
config_tmp_p.write("Feedback : "+
|
|
str(self.feedback_var.get())+"\n")
|
|
config_tmp_p.write("Gain : "+
|
|
str(self.gain_var.get())+"\n")
|
|
config_tmp_p.write("Speed : "+
|
|
str(self.speed_var.get())+"\n")
|
|
config_tmp_p.write("Amplitude : "+
|
|
str(self.ampl_var.get())+"\n")
|
|
config_tmp_p.write("Angle : "+
|
|
str(self.angle_var.get())+"\n")
|
|
config_tmp_p.write("Deleting thumbs before : "+
|
|
str(self.thumbs_before_var.get())+"\n")
|
|
config_tmp_p.write("Deleting thumbs after : "+
|
|
str(self.thumbs_after_var.get())+"\n")
|
|
config_tmp_p.write("Extra directories : "+
|
|
str(self.extra_directories_var.get())+"\n")
|
|
config_tmp_p.write("Replace pdfs : "+
|
|
str(self.pdfs_var.get())+"\n")
|
|
config_tmp_p.write("Subdirs : "+
|
|
str(self.subdirs_var.get())+"\n")
|
|
config_tmp_p.write("Spektral Options : "+
|
|
str(self.skala_var.get())+"\n")
|
|
config_tmp_p.write("Format Options : "+
|
|
str(self.format_var.get())+"\n")
|
|
config_tmp_p.write("Peek Options : "+
|
|
str(self.peek_var.get())+"\n")
|
|
config_tmp_p.write("Minimum on zero Options: "+
|
|
str(self.minimum_on_zero_var.get())+"\n")
|
|
# config_tmp_p.write("RHK Special Options : "+
|
|
# str(self.rhk_opt_var.get())+"\n")
|
|
config_tmp_p.write("Master directory : "+
|
|
str(self.masterdir.get())+"\n")
|
|
config_tmp_p.write("Filename : "+
|
|
str(self.filename.get())+"\n")
|
|
config_tmp_p.write("Color : "+
|
|
str(self.color_menu.get())+"\n")
|
|
config_tmp_p.write("File extension : "+
|
|
str(self.extension.get())+"\n")
|
|
config_tmp_p.write("Direction : "+
|
|
str(self.thumbs_var.get())+"\n")
|
|
config_tmp_p.write("Linefit : "+
|
|
str(self.lin_var.get())+"\n")
|
|
config_tmp_p.write("Planefit : "+
|
|
str(self.plane_var.get())+"\n")
|
|
config_tmp_p.write("AddChannel : "+
|
|
str(self.num)+"\n")
|
|
config_tmp_p.write("ChannelNumber : "+
|
|
str(len(self.name_list)-8)+"\n")
|
|
config_tmp_p.write("Tooltips : "+
|
|
str(self.tooltip_var.get())+"\n")
|
|
|
|
for i in range(len(self.name_list)-8):
|
|
stri = "Channelname " + str(i+1)
|
|
|
|
if int((i+1)/10) == 0:
|
|
stri += " : "+str(self.name_list[i+8].get())+"\n"
|
|
elif int((i+1)/10) < 10:
|
|
stri += " : "+str(self.name_list[i+8].get())+"\n"
|
|
elif int((i+1)/10) < 100:
|
|
stri += " : "+str(self.name_list[i+8].get())+"\n"
|
|
else:
|
|
continue
|
|
|
|
config_tmp_p.write(stri)
|
|
|
|
for i in range(len(self.thumb_list)):
|
|
stri = "Thumb " + str(i+1)
|
|
|
|
if int((i+1)/10) == 0:
|
|
stri += " : "+str(self.thumb_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 10:
|
|
stri += " : "+str(self.thumb_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 100:
|
|
stri += " : "+str(self.thumb_list[i].get())+"\n"
|
|
else:
|
|
continue
|
|
|
|
config_tmp_p.write(stri)
|
|
|
|
for i in range(len(self.linefit_list)):
|
|
stri = "LineFit " + str(i+1)
|
|
|
|
if int((i+1)/10) == 0:
|
|
stri += " : "+str(self.linefit_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 10:
|
|
stri += " : "+str(self.linefit_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 100:
|
|
stri += " : "+str(self.linefit_list[i].get())+"\n"
|
|
else:
|
|
continue
|
|
|
|
config_tmp_p.write(stri)
|
|
|
|
for i in range(len(self.planefit_list)):
|
|
stri = "PlaneFit " + str(i+1)
|
|
|
|
if int((i+1)/10) == 0:
|
|
stri += " : "+str(self.planefit_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 10:
|
|
stri += " : "+str(self.planefit_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 100:
|
|
stri += " : "+str(self.planefit_list[i].get())+"\n"
|
|
else:
|
|
continue
|
|
|
|
config_tmp_p.write(stri)
|
|
|
|
for i in range(len(self.planefit_list)):
|
|
stri = "Inverted " + str(i+1)
|
|
|
|
if int((i+1)/10) == 0:
|
|
stri += " : "+str(self.invert_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 10:
|
|
stri += " : "+str(self.invert_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 100:
|
|
stri += " : "+str(self.invert_list[i].get())+"\n"
|
|
else:
|
|
continue
|
|
|
|
config_tmp_p.write(stri)
|
|
|
|
for i in range(len(self.color_list)):
|
|
stri = "Color " + str(i+1)
|
|
|
|
if int((i+1)/10) == 0:
|
|
stri += " : "+str(self.color_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 10:
|
|
stri += " : "+str(self.color_list[i].get())+"\n"
|
|
elif int((i+1)/10) < 100:
|
|
stri += " : "+str(self.color_list[i].get())+"\n"
|
|
else:
|
|
continue
|
|
|
|
config_tmp_p.write(stri)
|
|
|
|
config_tmp_p.close()
|
|
|
|
os.remove(self.filepath_config)
|
|
os.rename(file_tmp, self.filepath_config)
|
|
|
|
def default(self):
|
|
|
|
'''
|
|
Sets all Options to its default values
|
|
'''
|
|
|
|
# The default values are set.
|
|
self.n_col.delete(0, END)
|
|
self.n_col.insert(0, "4")
|
|
self.n_row.delete(0, END)
|
|
self.n_row.insert(0, "6")
|
|
self.row_update("<Button-1>")
|
|
self.col_update("<Button-1>")
|
|
self.rms.delete(0, END)
|
|
self.rms.insert(0, "2")
|
|
self.res.delete(0, END)
|
|
self.res.insert(0, "100")
|
|
self.jpeg.delete(0, END)
|
|
self.jpeg.insert(0, "40")
|
|
self.text_size.delete(0, END)
|
|
self.text_size.insert(0, "11")
|
|
self.text_x.delete(0, END)
|
|
self.text_x.insert(0, "0")
|
|
self.text_y.delete(0, END)
|
|
self.text_y.insert(0, "0")
|
|
self.text_block.delete(0, END)
|
|
self.text_block.insert(0, "0")
|
|
# self.text_block_height.delete(0, END)
|
|
# self.text_block_height.insert(0, "0")deselect_met
|
|
self.date.select()
|
|
self.sizenm.select()
|
|
self.sizepx.select()
|
|
self.offset.select()
|
|
self.voltage.select()
|
|
self.feedback.select()
|
|
self.gain.select()
|
|
self.speed.select()
|
|
self.ampl.select()
|
|
self.angle.select()
|
|
self.thumbs_before.select()
|
|
self.thumbs_after.select()
|
|
self.extra_directories.deselect()
|
|
self.pdfs.deselect()
|
|
self.subdirs.deselect()
|
|
# self.rhk_opt.select()
|
|
|
|
self.thumbs_all.select()
|
|
self.thumbs_for.deselect()
|
|
self.thumbs_back.deselect()
|
|
self.thumbs_none.deselect()
|
|
self.lin_all.select()
|
|
self.lin_for.deselect()
|
|
self.lin_back.deselect()
|
|
self.lin_none.deselect()
|
|
self.plane_all.select()
|
|
self.plane_for.deselect()
|
|
self.plane_back.deselect()
|
|
self.plane_none.deselect()
|
|
|
|
self.masterdir.delete(0, END)
|
|
self.masterdir.insert(0, "")
|
|
self.extension.delete(0, END)
|
|
self.extension.insert(0, "")
|
|
|
|
for i in range(2,6):
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if i == 2:
|
|
wid.select()
|
|
elif i == 3:
|
|
wid.select()
|
|
elif i == 4:
|
|
wid.deselect()
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
for i in range(2,6):
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if i == 2:
|
|
wid.select()
|
|
elif i == 3:
|
|
wid.select()
|
|
elif i == 4:
|
|
wid.deselect()
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
# The following methods let you select or deselect the Checkboxes in
|
|
# frameOne and listFrame
|
|
|
|
# Select Thumbs Methods
|
|
def select_thumbs_all(self):
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=2)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=2)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=2)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=2)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
def select_thumbs_for(self):
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
if i == 2:
|
|
wid.select()
|
|
else:
|
|
dir_count = 0
|
|
if i == 2:
|
|
wid.deselect()
|
|
elif i == 3:
|
|
wid.deselect()
|
|
elif i == 4:
|
|
wid.deselect()
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
if i == 2:
|
|
wid.select()
|
|
else:
|
|
dir_count = 0
|
|
if i == 2:
|
|
wid.deselect()
|
|
elif i == 3:
|
|
wid.deselect()
|
|
elif i == 4:
|
|
wid.deselect()
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
def select_thumbs_back(self):
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
if i == 2:
|
|
wid.select()
|
|
else:
|
|
dir_count = 1
|
|
if i == 2:
|
|
wid.deselect()
|
|
elif i == 3:
|
|
wid.deselect()
|
|
elif i == 4:
|
|
wid.deselect()
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
for i in range(2,5):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
if i == 2:
|
|
wid.select()
|
|
else:
|
|
dir_count = 1
|
|
if i == 2:
|
|
wid.deselect()
|
|
elif i == 3:
|
|
wid.deselect()
|
|
elif i == 4:
|
|
wid.deselect()
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
def select_thumbs_none(self):
|
|
|
|
self.lin_none.select()
|
|
self.select_lin_none()
|
|
|
|
self.plane_none.select()
|
|
self.select_plane_none()
|
|
|
|
self.invert_none.select()
|
|
self.select_invert_none()
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=2)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=2)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=2)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=2)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
|
|
# Select Linefit Methods
|
|
|
|
def select_lin_all(self):
|
|
|
|
self.thumbs_all.select()
|
|
self.select_thumbs_all()
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=3)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=3)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=3)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=3)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
def select_lin_for(self):
|
|
|
|
for i in range(2,4):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
wid.select()
|
|
else:
|
|
dir_count = 0
|
|
if i == 2:
|
|
continue
|
|
elif i == 3:
|
|
wid.deselect()
|
|
|
|
for i in range(2,4):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
wid.select()
|
|
else:
|
|
dir_count = 0
|
|
if i == 2:
|
|
continue
|
|
elif i == 3:
|
|
wid.deselect()
|
|
|
|
def select_lin_back(self):
|
|
|
|
for i in range(2,4):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
wid.select()
|
|
else:
|
|
dir_count = 1
|
|
if i == 2:
|
|
continue
|
|
elif i == 3:
|
|
wid.deselect()
|
|
|
|
for i in range(2,4):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
wid.select()
|
|
else:
|
|
dir_count = 1
|
|
if i == 2:
|
|
continue
|
|
elif i == 3:
|
|
wid.deselect()
|
|
|
|
def select_lin_none(self):
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=3)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=3)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=3)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=3)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
# Select Planefit Methods
|
|
|
|
def select_plane_all(self):
|
|
|
|
self.thumbs_all.select()
|
|
self.select_thumbs_all()
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=4)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=4)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=4)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=4)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
def select_plane_for(self):
|
|
|
|
for i in range(2,5):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
if i == 2 or i == 4:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 0
|
|
if i == 2 or i == 3:
|
|
continue
|
|
elif i == 4:
|
|
wid.deselect()
|
|
|
|
for i in range(2,5):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
if i == 2 or i == 4:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 0
|
|
if i == 2 or i == 3:
|
|
continue
|
|
elif i == 4:
|
|
wid.deselect()
|
|
|
|
|
|
def select_plane_back(self):
|
|
|
|
for i in range(2,5):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
if i == 2 or i == 4:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 1
|
|
if i == 2 or i == 3:
|
|
continue
|
|
elif i == 4:
|
|
wid.deselect()
|
|
|
|
for i in range(2,5):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
if i == 2 or i == 4:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 1
|
|
if i == 2 or i == 3:
|
|
continue
|
|
elif i == 4:
|
|
wid.deselect()
|
|
|
|
def select_plane_none(self):
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=4)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=4)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=4)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=4)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
# Select Invert Methods
|
|
|
|
def select_invert_all(self):
|
|
|
|
self.thumbs_all.select()
|
|
self.select_thumbs_all()
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=5)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=5)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=5)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=5)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.select()
|
|
|
|
def select_invert_for(self):
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
if i == 2 or i == 5:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 0
|
|
if i == 2 or i == 3 or i == 4:
|
|
continue
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 0:
|
|
dir_count = 1
|
|
if i == 2 or i == 5:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 0
|
|
if i == 2 or i == 3 or i == 4:
|
|
continue
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
def select_invert_back(self):
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
if i == 2 or i == 5:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 1
|
|
if i == 2 or i == 3 or i == 4:
|
|
continue
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
for i in range(2,6):
|
|
dir_count = 0
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=i)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=i)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if dir_count == 1:
|
|
dir_count = 0
|
|
if i == 2 or i == 5:
|
|
wid.select()
|
|
else:
|
|
continue
|
|
else:
|
|
dir_count = 1
|
|
if i == 2 or i == 3 or i == 4:
|
|
continue
|
|
elif i == 5:
|
|
wid.deselect()
|
|
|
|
def select_invert_none(self):
|
|
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=5)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=5)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=5)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=5)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
wid.deselect()
|
|
|
|
|
|
# Checkbox options
|
|
|
|
def select_met(self):
|
|
|
|
list_count = 0
|
|
for j in range(2,21):
|
|
if len(self.frameOne.grid_slaves(row=j, column=2)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=2)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if (self.linefit_list[list_count].get() or
|
|
self.planefit_list[list_count].get() or
|
|
self.invert_list[list_count].get()):
|
|
wid.select()
|
|
list_count += 1
|
|
|
|
for j in range(self.num):
|
|
if len(self.listFrame.grid_slaves(row=j, column=2)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=2)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if (self.linefit_list[list_count].get() or
|
|
self.planefit_list[list_count].get() or
|
|
self.invert_list[list_count].get()):
|
|
wid.select()
|
|
list_count += 1
|
|
|
|
def deselect_met(self):
|
|
|
|
list_count = 0
|
|
for j in range(2,21):
|
|
|
|
if len(self.frameOne.grid_slaves(row=j, column=3)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=3)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if not self.thumb_list[list_count].get():
|
|
wid.deselect()
|
|
|
|
|
|
if len(self.frameOne.grid_slaves(row=j, column=4)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=4)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if not self.thumb_list[list_count].get():
|
|
wid.deselect()
|
|
|
|
if len(self.frameOne.grid_slaves(row=j, column=5)) != 0:
|
|
wid = self.frameOne.grid_slaves(row=j, column=5)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if not self.thumb_list[list_count].get():
|
|
wid.deselect()
|
|
list_count += 1
|
|
|
|
for j in range(self.num):
|
|
|
|
if len(self.listFrame.grid_slaves(row=j, column=3)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=3)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if not self.thumb_list[list_count].get():
|
|
wid.deselect()
|
|
|
|
|
|
if len(self.listFrame.grid_slaves(row=j, column=4)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=4)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if not self.thumb_list[list_count].get():
|
|
wid.deselect()
|
|
|
|
if len(self.listFrame.grid_slaves(row=j, column=5)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=j, column=5)[0]
|
|
if isinstance(wid, Checkbutton):
|
|
if not self.thumb_list[list_count].get():
|
|
wid.deselect()
|
|
list_count += 1
|
|
|
|
# Choose dir and choose pdf Path Methods
|
|
|
|
def choose_dir(self):
|
|
|
|
'''
|
|
Let one specific the working path
|
|
'''
|
|
|
|
config_file_p = open(self.filepath_config, "r")
|
|
for line in config_file_p:
|
|
if "Last directory:" in line:
|
|
position = str.find(line, ":")
|
|
start_directory = line[position+2:-1]
|
|
config_file_p.close()
|
|
|
|
self.working_directory = filedialog.askdirectory(
|
|
initialdir=start_directory,
|
|
title='Select a directory')
|
|
|
|
config_file_p = open(self.filepath_config, "r")
|
|
file_tmp = self.filepath_config[:-5] + "_tmp.conf"
|
|
config_tmp_p = open(file_tmp, "w")
|
|
|
|
for line in config_file_p:
|
|
if "Last directory:" in line:
|
|
string = "Last directory: "+self.working_directory+"\n"
|
|
config_tmp_p.write(string)
|
|
else:
|
|
config_tmp_p.write(line)
|
|
|
|
config_file_p.close()
|
|
config_tmp_p.close()
|
|
|
|
os.remove(self.filepath_config)
|
|
os.rename(file_tmp, self.filepath_config)
|
|
|
|
def pdf_path_select(self):
|
|
|
|
'''
|
|
Let one specific the pdf path
|
|
'''
|
|
|
|
config_file_p = open(self.filepath_config, "r")
|
|
for line in config_file_p:
|
|
if "PDF Path:" in line:
|
|
position = str.find(line, ":")
|
|
start_directory = line[position+2:-1]
|
|
config_file_p.close()
|
|
|
|
self.pdf_path = filedialog.askdirectory(
|
|
initialdir=start_directory,
|
|
title='Select a directory')
|
|
|
|
config_file_p = open(self.filepath_config, "r")
|
|
file_tmp = self.filepath_config[:-5] + "_tmp.conf"
|
|
config_tmp_p = open(file_tmp, "w")
|
|
|
|
for line in config_file_p:
|
|
if "PDF Path:" in line:
|
|
string = "PDF Path: "+self.pdf_path+"\n"
|
|
config_tmp_p.write(string)
|
|
else:
|
|
config_tmp_p.write(line)
|
|
|
|
config_file_p.close()
|
|
config_tmp_p.close()
|
|
|
|
os.remove(self.filepath_config)
|
|
os.rename(file_tmp, self.filepath_config)
|
|
|
|
def run_process(self):
|
|
|
|
'''
|
|
Starts the working process
|
|
'''
|
|
|
|
if (self.working_directory == ""):
|
|
tkMessageBox.showinfo(globvar_name,
|
|
"You need to load a directory !")
|
|
|
|
# Saving all GUI-Variables to global Variables
|
|
else:
|
|
|
|
globvar_ThumbPara.row = int(self.n_row.get())
|
|
globvar_ThumbPara.col = int(self.n_col.get())
|
|
globvar_ThumbPara.rms = self.rms.get()
|
|
globvar_ThumbPara.res = self.res.get()
|
|
globvar_ThumbPara.font = self.font_menu.get()
|
|
globvar_ThumbPara.jpeg = self.jpeg.get()
|
|
globvar_ThumbPara.thumbs_before = self.thumbs_before_var.get()
|
|
globvar_ThumbPara.thumbs_after = self.thumbs_after_var.get()
|
|
globvar_ThumbPara.peek = self.peek_var.get()
|
|
globvar_ThumbPara.minimum_on_zero= self.minimum_on_zero_var.get()
|
|
globvar_ThumbPara.png = self.format_var.get()
|
|
globvar_ThumbPara.date = self.date_var.get()
|
|
globvar_ThumbPara.sizenm = self.sizenm_var.get()
|
|
globvar_ThumbPara.sizepx = self.sizepx_var.get()
|
|
globvar_ThumbPara.offset = self.offset_var.get()
|
|
globvar_ThumbPara.voltage = self.voltage_var.get()
|
|
globvar_ThumbPara.feedback = self.feedback_var.get()
|
|
globvar_ThumbPara.gain = self.gain_var.get()
|
|
globvar_ThumbPara.speed = self.speed_var.get()
|
|
globvar_ThumbPara.ampl = self.ampl_var.get()
|
|
globvar_ThumbPara.text_block = self.text_block.get()
|
|
# globvar_ThumbPara.text_block_height = self.text_block_height.get()
|
|
globvar_ThumbPara.text_size = self.text_size.get()
|
|
globvar_ThumbPara.text_x = str(float( \
|
|
self.text_x.get())/100.0)
|
|
globvar_ThumbPara.text_y = str(float( \
|
|
self.text_y.get())/100.0)
|
|
globvar_ThumbPara.angle = self.angle_var.get()
|
|
globvar_ThumbPara.extra_direct = self.extra_directories_var.get()
|
|
globvar_ThumbPara.pdfs = self.pdfs_var.get()
|
|
globvar_ThumbPara.subdirs = self.subdirs_var.get()
|
|
globvar_ThumbPara.masterdir = self.masterdir.get()
|
|
globvar_ThumbPara.extension = self.extension.get()
|
|
globvar_ThumbPara.filename = self.filename.get()
|
|
globvar_ThumbPara.spektra = self.skala_var.get()
|
|
|
|
globvar_ThumbPara.channel_names = [i.get() for i in \
|
|
self.name_list[8:]]
|
|
|
|
globvar_ThumbPara.thumbs = [i.get() for i in \
|
|
self.thumb_list]
|
|
globvar_ThumbPara.line_fit = [i.get() for i in \
|
|
self.linefit_list]
|
|
globvar_ThumbPara.plane_fit = [i.get() for i in \
|
|
self.planefit_list]
|
|
globvar_ThumbPara.invert = [i.get() for i in \
|
|
self.invert_list]
|
|
|
|
globvar_ThumbPara.geometry_x.append(globvar_thumb_size_x *
|
|
float(globvar_ThumbPara.res))
|
|
globvar_ThumbPara.geometry_y.append(globvar_thumb_size_y *
|
|
float(globvar_ThumbPara.res))
|
|
|
|
globvar_AFMdir.pdf_path = self.pdf_path
|
|
|
|
globvar_ThumbPara.colors = [define_color(i.get()) for i in \
|
|
self.color_list]
|
|
|
|
# Renew Config File with new Values
|
|
self.WriteConfigFile()
|
|
|
|
# Start working process
|
|
start = timer()
|
|
|
|
initialize_and_go(self.working_directory, None)
|
|
|
|
end = timer()
|
|
seconds = timedelta(seconds=end - start)
|
|
time_passed = datetime(1,1,1) + seconds
|
|
print(globvar_timepassed_1 +
|
|
globvar_timepassed_2
|
|
% (time_passed.day-1,
|
|
time_passed.hour,
|
|
time_passed.minute,
|
|
(end - start) % 60))
|
|
|
|
messagebox.showinfo(globvar_name, "Finished !")
|
|
|
|
def done(self):
|
|
|
|
'''
|
|
Finish all remaining tasks
|
|
'''
|
|
|
|
# Update (write) the config file.
|
|
self.WriteConfigFile()
|
|
|
|
# End of all
|
|
self.master.destroy()
|
|
|
|
def info(self):
|
|
|
|
'''
|
|
Shows info box
|
|
'''
|
|
|
|
messagebox.showinfo(globvar_name, globvar_note)
|
|
|
|
# Show a plot of gradients. See Colours.py
|
|
def show_colours(self):
|
|
|
|
plot_color_gradients()
|
|
|
|
# This definition clarifies, which fonts are available on the system and
|
|
# which of the preferred fonts in 'globvar_fonts' is in the list of
|
|
# available_fonts. Return the list of available preferred fonts.
|
|
def get_fonts(self):
|
|
|
|
|
|
# 2018-09-12: This is used to sort bad fonts which may
|
|
# break the code.
|
|
GO = True;
|
|
avaible_fonts = []
|
|
for fontdetail in matplotlib.font_manager.findSystemFonts():
|
|
for bad_font in globvar_bad_fonts:
|
|
if bad_font in fontdetail:
|
|
print(globvar_spaces + "Bad font: " + bad_font + "\n")
|
|
GO = False
|
|
break
|
|
|
|
if GO == False:
|
|
continue
|
|
|
|
font = matplotlib.font_manager.FontProperties(fname=fontdetail).get_name()
|
|
avaible_fonts.append(font)
|
|
|
|
font_list = []
|
|
for font in globvar_fonts:
|
|
if font in avaible_fonts:
|
|
font_list.append(font)
|
|
|
|
return font_list
|
|
|
|
# _________________ Event Methods
|
|
# _________________ The following methods are for the binding to widgets
|
|
|
|
# Focus binding
|
|
def callback(self,event):
|
|
self.focus_set()
|
|
|
|
def lost_focus(self,event):
|
|
self.master.focus_set()
|
|
|
|
# Change label and change entry bindings
|
|
def change_label(self,event):
|
|
skip_next = False
|
|
label_counter = 8
|
|
ent = ""
|
|
|
|
for i in range(10,self.num):
|
|
|
|
if skip_next:
|
|
skip_next = False
|
|
continue
|
|
|
|
numwid = len(self.listFrame.grid_slaves(row=i, column=0))
|
|
if numwid != 0:
|
|
wid = self.listFrame.grid_slaves(row=i, column=0)
|
|
if isinstance(wid[0], Entry):
|
|
ent = wid[0].get()
|
|
elif isinstance(wid[0], Label):
|
|
if ent != self.name_list[label_counter].get():
|
|
self.name_list[label_counter].set(ent)
|
|
ent = ""
|
|
label_counter += 1
|
|
if label_counter%2 == 0:
|
|
skip_next = True
|
|
|
|
def change_entry(self):
|
|
label_counter = 8
|
|
|
|
for i in range(10,self.num):
|
|
if len(self.listFrame.grid_slaves(row=i, column=0)) != 0:
|
|
wid = self.listFrame.grid_slaves(row=i, column=0)
|
|
if isinstance(wid[0], Entry):
|
|
wid[0].insert(0,self.name_list[label_counter].get())
|
|
label_counter += 1
|
|
else:
|
|
continue
|
|
|
|
# Tooltips bindings
|
|
|
|
def sh_tooltips(self):
|
|
|
|
# tooltips
|
|
# Arrangement
|
|
self.n_col.bind("<FocusOut>", self.row_update, add="+")
|
|
self.n_row.bind("<FocusOut>", self.col_update, add="+")
|
|
self.n_col.bind("<Return>", self.row_update, add="+")
|
|
self.n_row.bind("<Return>", self.col_update, add="+")
|
|
|
|
create_tool_tip(self.n_col, self.col_tip())
|
|
create_tool_tip(self.n_row, self.row_tip())
|
|
|
|
create_tool_tip(self.rms, TT_rms)
|
|
create_tool_tip(self.res, TT_res)
|
|
create_tool_tip(self.jpeg, TT_qual)
|
|
|
|
# Position
|
|
create_tool_tip(self.text_size, TT_size)
|
|
create_tool_tip(self.text_x, TT_dx_pos)
|
|
create_tool_tip(self.text_y, TT_dy_pos)
|
|
create_tool_tip(self.text_block, TT_dw)
|
|
|
|
# Specification
|
|
create_tool_tip(self.extension, TT_file_ex)
|
|
create_tool_tip(self.masterdir, TT_master_dir)
|
|
create_tool_tip(self.filename, TT_filename)
|
|
|
|
# Parameters
|
|
create_tool_tip(self.date, TT_date)
|
|
create_tool_tip(self.sizenm, TT_size_nm)
|
|
create_tool_tip(self.sizepx, TT_size_px)
|
|
create_tool_tip(self.offset, TT_off)
|
|
create_tool_tip(self.voltage, TT_vol)
|
|
create_tool_tip(self.feedback, TT_feed)
|
|
create_tool_tip(self.gain, TT_loop)
|
|
create_tool_tip(self.speed, TT_speed)
|
|
create_tool_tip(self.ampl, TT_amp)
|
|
create_tool_tip(self.angle, TT_angle)
|
|
|
|
# Other
|
|
create_tool_tip(self.thumbs_before, TT_thumb_before)
|
|
create_tool_tip(self.thumbs_after, TT_thumb_after)
|
|
create_tool_tip(self.extra_directories, TT_extra_dir)
|
|
create_tool_tip(self.pdfs, TT_pdfs)
|
|
create_tool_tip(self.subdirs, TT_subdirs)
|
|
create_tool_tip(self.format, TT_png)
|
|
create_tool_tip(self.skala, TT_spektral)
|
|
create_tool_tip(self.peek, TT_peek)
|
|
create_tool_tip(self.minimum_on_zero, TT_minimum_on_zero)
|
|
# create_tool_tip(self.rhk_opt, TT_Reich)
|
|
|
|
def no_tooltips(self):
|
|
|
|
# Special Unbinding for column and row
|
|
self.n_col.unbind("<FocusOut>")
|
|
self.n_row.unbind("<FocusOut>")
|
|
self.n_col.unbind("<Return>")
|
|
self.n_row.unbind("<Return>")
|
|
self.n_col.bind("<Return>", self.lost_focus)
|
|
self.n_row.bind("<Return>", self.lost_focus)
|
|
|
|
# Arrangement
|
|
self.n_col.unbind('<Enter>')
|
|
self.n_col.unbind('<Leave>')
|
|
self.n_row.unbind('<Enter>')
|
|
self.n_row.unbind('<Leave>')
|
|
self.rms.unbind('<Enter>')
|
|
self.rms.unbind('<Leave>')
|
|
self.res.unbind('<Enter>')
|
|
self.res.unbind('<Leave>')
|
|
self.jpeg.unbind('<Enter>')
|
|
self.jpeg.unbind('<Leave>')
|
|
|
|
# Position
|
|
self.text_size.unbind('<Enter>')
|
|
self.text_size.unbind('<Leave>')
|
|
self.text_x.unbind('<Enter>')
|
|
self.text_x.unbind('<Leave>')
|
|
self.text_y.unbind('<Enter>')
|
|
self.text_y.unbind('<Leave>')
|
|
self.text_block.unbind('<Enter>')
|
|
self.text_block.unbind('<Leave>')
|
|
|
|
# Specification
|
|
self.extension.unbind('<Enter>')
|
|
self.extension.unbind('<Leave>')
|
|
self.masterdir.unbind('<Enter>')
|
|
self.masterdir.unbind('<Leave>')
|
|
self.filename.unbind('<Enter>')
|
|
self.filename.unbind('<Leave>')
|
|
|
|
# Parameters
|
|
self.date.unbind('<Enter>')
|
|
self.date.unbind('<Leave>')
|
|
self.sizenm.unbind('<Enter>')
|
|
self.sizenm.unbind('<Leave>')
|
|
self.sizepx.unbind('<Enter>')
|
|
self.sizepx.unbind('<Leave>')
|
|
self.offset.unbind('<Enter>')
|
|
self.offset.unbind('<Leave>')
|
|
self.voltage.unbind('<Enter>')
|
|
self.voltage.unbind('<Leave>')
|
|
self.feedback.unbind('<Enter>')
|
|
self.feedback.unbind('<Leave>')
|
|
self.gain.unbind('<Enter>')
|
|
self.gain.unbind('<Leave>')
|
|
self.speed.unbind('<Enter>')
|
|
self.speed.unbind('<Leave>')
|
|
self.ampl.unbind('<Enter>')
|
|
self.ampl.unbind('<Leave>')
|
|
self.angle.unbind('<Enter>')
|
|
self.angle.unbind('<Leave>')
|
|
|
|
# Other
|
|
self.thumbs_before.unbind('<Enter>')
|
|
self.thumbs_before.unbind('<Leave>')
|
|
self.thumbs_after.unbind('<Enter>')
|
|
self.thumbs_after.unbind('<Leave>')
|
|
self.extra_directories.unbind('<Enter>')
|
|
self.extra_directories.unbind('<Leave>')
|
|
self.pdfs.unbind('<Enter>')
|
|
self.pdfs.unbind('<Leave>')
|
|
self.subdirs.unbind('<Enter>')
|
|
self.subdirs.unbind('<Leave>')
|
|
self.format.unbind('<Enter>')
|
|
self.format.unbind('<Leave>')
|
|
self.skala.unbind('<Enter>')
|
|
self.skala.unbind('<Leave>')
|
|
self.peek.unbind('<Enter>')
|
|
self.peek.unbind('<Leave>')
|
|
self.minimum_on_zero.unbind('<Enter>')
|
|
self.minimum_on_zero.unbind('<Leave>')
|
|
|
|
def row_update(self,event):
|
|
|
|
create_tool_tip(self.n_row, self.row_tip())
|
|
|
|
def col_update(self,event):
|
|
|
|
create_tool_tip(self.n_col, self.col_tip())
|
|
|
|
def col_tip(self):
|
|
|
|
st = ("DIN A4 portrait format: " +
|
|
"{0:.2f}".format(297.0/(210.0/int(self.n_row.get()))))
|
|
st += " to " + self.n_row.get() + "\n"
|
|
st += ("DIN A4 landscape format: " +
|
|
"{0:.2f}".format(210.0/(297.0/int(self.n_row.get()))))
|
|
st += " to " + self.n_row.get()
|
|
|
|
return TT_n_col + st
|
|
|
|
def row_tip(self):
|
|
|
|
st = "DIN A4 portrait format: " + self.n_col.get()
|
|
st += (" to " + "{0:.2f}".format(210.0/(297.0/int(self.n_col.get()))) +
|
|
"\n")
|
|
st += "DIN A4 landscape format: " + self.n_col.get()
|
|
st += " to " + "{0:.2f}".format(297.0/(210.0/int(self.n_col.get())))
|
|
|
|
return TT_n_row + st
|
|
|
|
# Mousewheel binding
|
|
def mouse_wheel(self,event):
|
|
if self.op_sys == "Windows" or self.op_sys == "Linux":
|
|
# This is for Linux
|
|
if event.num == 5:
|
|
self.canvas.yview_scroll(1,"units")
|
|
elif event.num == 4:
|
|
self.canvas.yview_scroll(-1,"units")
|
|
# This is for Windows...
|
|
else:
|
|
self.canvas.yview_scroll(-1*(event.delta/120), "units")
|
|
elif self.op_sys == "Darwin":
|
|
self.canvas.yview_scroll(-1*(event.delta), "units")
|
|
else:
|
|
self.canvas.yview_scroll(-1*(event.delta/120), "units")
|
|
|
|
def activate_mousewheel(self, event):
|
|
# Mousewheel binding
|
|
# With Windows and Mac OS
|
|
self.canvas.bind_all("<MouseWheel>", self.mouse_wheel)
|
|
# with Linux OS
|
|
self.canvas.bind_all("<Button-4>", self.mouse_wheel)
|
|
self.canvas.bind_all("<Button-5>", self.mouse_wheel)
|
|
|
|
def deactivate_mousewheel(self, event):
|
|
# Mousewheel unbinding
|
|
# With Windows and Mac OS
|
|
self.canvas.unbind_all("<MouseWheel>")
|
|
# with Linux OS
|
|
self.canvas.unbind_all("<Button-4>")
|
|
self.canvas.unbind_all("<Button-5>")
|
|
|
|
# The following methods create and delete Entry lines
|
|
|
|
# Scrollbar Frame
|
|
def AuxscrollFunction(self,event):
|
|
# You need to set a max size for frameTwo. Otherwise, it will grow as
|
|
# needed, and the scrollbar does not act.
|
|
if self.op_sys == "Linux":
|
|
self.canvas.configure(scrollregion=self.canvas.bbox("all"),
|
|
width=600,
|
|
height=200)
|
|
|
|
elif self.op_sys == "Windows":
|
|
self.canvas.configure(scrollregion=self.canvas.bbox("all"),
|
|
width=550,
|
|
height=200)
|
|
|
|
else:
|
|
self.canvas.configure(scrollregion=self.canvas.bbox("all"),
|
|
width=600,
|
|
height=200)
|
|
|
|
def accept_parts(self):
|
|
|
|
self.accept_parts_ok()
|
|
# The grid scrollbar is in master, because the user had defined the
|
|
# numer of pieces.
|
|
self.scrollb.grid(row=2, column=1, sticky='nsew')
|
|
|
|
def accept_parts_ok(self):
|
|
|
|
self.num = 10
|
|
self.addtime = 0
|
|
|
|
while self.num < self.numChan-1:
|
|
|
|
self.addtime += 2
|
|
|
|
extra_channel = Entry(self.listFrame, width=12)
|
|
extra_channel.delete(0, END)
|
|
extra_channel.bind("<KeyRelease>", self.change_label)
|
|
extra_channel.bind("<Button-1>", self.callback)
|
|
extra_channel.bind("<Return>", self.lost_focus)
|
|
extra_channel.grid(row=self.num, column=0, sticky=W)
|
|
self.label_text = StringVar()
|
|
Label(self.listFrame,
|
|
textvariable=self.label_text).grid(row=self.num+1,
|
|
column=0,
|
|
sticky=W)
|
|
self.name_list.append(self.label_text)
|
|
|
|
|
|
Label(self.listFrame, text=" --->").grid(row=self.num,
|
|
column=1,
|
|
sticky=W)
|
|
Label(self.listFrame, text=" <---").grid(row=self.num+1,
|
|
column=1,
|
|
sticky=W)
|
|
|
|
self.thumbs_temp1_var = IntVar()
|
|
self.thumbs_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.thumbs_temp1_var,
|
|
command=self.deselect_met)
|
|
self.thumbs_temp1.grid(row=self.num, column=2, sticky=W)
|
|
self.thumb_list.append(self.thumbs_temp1_var)
|
|
|
|
self.thumbs_temp2_var = IntVar()
|
|
self.thumbs_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.thumbs_temp2_var,
|
|
command=self.deselect_met)
|
|
self.thumbs_temp2.grid(row=self.num+1, column=2, sticky=W)
|
|
self.thumb_list.append(self.thumbs_temp2_var)
|
|
|
|
self.line_fit_temp1_var = IntVar()
|
|
self.line_fit_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.line_fit_temp1_var,
|
|
command=self.select_met)
|
|
self.line_fit_temp1.grid(row=self.num, column=3, sticky=W)
|
|
self.linefit_list.append(self.line_fit_temp1_var)
|
|
|
|
self.line_fit_temp2_var = IntVar()
|
|
self.line_fit_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.line_fit_temp2_var,
|
|
command=self.select_met)
|
|
self.line_fit_temp2.grid(row=self.num+1, column=3, sticky=W)
|
|
self.linefit_list.append(self.line_fit_temp2_var)
|
|
|
|
self.plane_fit_temp1_var = IntVar()
|
|
self.plane_fit_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable= \
|
|
self.plane_fit_temp1_var,
|
|
command=self.select_met)
|
|
self.plane_fit_temp1.grid(row=self.num, column=4, sticky=W)
|
|
self.planefit_list.append(self.plane_fit_temp1_var)
|
|
|
|
self.plane_fit_temp2_var = IntVar()
|
|
self.plane_fit_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable= \
|
|
self.plane_fit_temp2_var,
|
|
command=self.select_met)
|
|
self.plane_fit_temp2.grid(row=self.num+1, column=4, sticky=W)
|
|
self.planefit_list.append(self.plane_fit_temp2_var)
|
|
|
|
self.invert_temp1_var = IntVar()
|
|
self.invert_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.invert_temp1_var,
|
|
command=self.select_met)
|
|
self.invert_temp1.grid(row=self.num, column=5, sticky=W)
|
|
self.invert_list.append(self.invert_temp1_var)
|
|
|
|
self.invert_temp2_var = IntVar()
|
|
self.invert_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.invert_temp2_var,
|
|
command=self.select_met)
|
|
self.invert_temp2.grid(row=self.num+1, column=5, sticky=W)
|
|
self.invert_list.append(self.invert_temp2_var)
|
|
|
|
self.color_menu_tmp1_var = StringVar()
|
|
self.color_menu_tmp1 = ttk.Combobox(self.listFrame,
|
|
textvariable= \
|
|
self.color_menu_tmp1_var,
|
|
values=globvar_color_options,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.color_menu_tmp1.grid(row=self.num, column=6, sticky=W)
|
|
self.color_menu_tmp1.current(0) # set selection
|
|
self.color_menu_tmp1.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
self.color_list.append(self.color_menu_tmp1_var)
|
|
|
|
self.color_menu_tmp2_var = StringVar()
|
|
self.color_menu_tmp2 = ttk.Combobox(self.listFrame,
|
|
textvariable= \
|
|
self.color_menu_tmp2_var,
|
|
values=globvar_color_options,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.color_menu_tmp2.grid(row=self.num+1, column=6, sticky=W)
|
|
self.color_menu_tmp2.current(0) # set selection
|
|
self.color_menu_tmp2.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
self.color_list.append(self.color_menu_tmp2_var)
|
|
|
|
self.num += 2
|
|
|
|
if self.addtime == 4:
|
|
self.addtime = 0
|
|
Label(self.listFrame, text=" ").grid(row=self.num, sticky=W)
|
|
self.num += 1
|
|
|
|
# Buttons for adding or deleting rows
|
|
|
|
self.addrow_button = Button(self.frameThree, text="Add row",
|
|
command=self.addrow, width=10)
|
|
self.addrow_button.grid(row=0, column=1, pady=(10,10))
|
|
|
|
self.deleterow_button = Button(self.frameThree, text="Delete row",
|
|
command=self.deleterow, width=10)
|
|
self.deleterow_button.grid(row=0, column=2, pady=(10,10))
|
|
|
|
def addrow(self):
|
|
|
|
self.addtime += 2
|
|
|
|
extra_channel = Entry(self.listFrame, width=12)
|
|
extra_channel.delete(0, END)
|
|
extra_channel.bind("<KeyRelease>", self.change_label)
|
|
extra_channel.bind("<Button-1>", self.callback)
|
|
extra_channel.bind("<Return>", self.lost_focus)
|
|
extra_channel.grid(row=self.num, column=0, sticky=W)
|
|
self.label_text = StringVar()
|
|
Label(self.listFrame,textvariable=self.label_text).grid(row=self.num+1,
|
|
column=0,
|
|
sticky=W)
|
|
self.name_list.append(self.label_text)
|
|
|
|
|
|
Label(self.listFrame, text=" --->").grid(row=self.num,
|
|
column=1,
|
|
sticky=W)
|
|
Label(self.listFrame, text=" <---").grid(row=self.num+1,
|
|
column=1,
|
|
sticky=W)
|
|
|
|
self.thumbs_temp1_var = IntVar()
|
|
self.thumbs_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.thumbs_temp1_var,
|
|
command=self.deselect_met)
|
|
self.thumbs_temp1.grid(row=self.num, column=2, sticky=W)
|
|
self.thumb_list.append(self.thumbs_temp1_var)
|
|
|
|
self.thumbs_temp2_var = IntVar()
|
|
self.thumbs_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.thumbs_temp2_var,
|
|
command=self.deselect_met)
|
|
self.thumbs_temp2.grid(row=self.num+1, column=2, sticky=W)
|
|
self.thumb_list.append(self.thumbs_temp2_var)
|
|
|
|
self.line_fit_temp1_var = IntVar()
|
|
self.line_fit_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.line_fit_temp1_var,
|
|
command=self.select_met)
|
|
self.line_fit_temp1.grid(row=self.num, column=3, sticky=W)
|
|
self.linefit_list.append(self.line_fit_temp1_var)
|
|
|
|
self.line_fit_temp2_var = IntVar()
|
|
self.line_fit_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.line_fit_temp2_var,
|
|
command=self.select_met)
|
|
self.line_fit_temp2.grid(row=self.num+1, column=3, sticky=W)
|
|
self.linefit_list.append(self.line_fit_temp2_var)
|
|
|
|
self.plane_fit_temp1_var = IntVar()
|
|
self.plane_fit_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.plane_fit_temp1_var,
|
|
command=self.select_met)
|
|
self.plane_fit_temp1.grid(row=self.num, column=4, sticky=W)
|
|
self.planefit_list.append(self.plane_fit_temp1_var)
|
|
|
|
self.plane_fit_temp2_var = IntVar()
|
|
self.plane_fit_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.plane_fit_temp2_var,
|
|
command=self.select_met)
|
|
self.plane_fit_temp2.grid(row=self.num+1, column=4, sticky=W)
|
|
self.planefit_list.append(self.plane_fit_temp2_var)
|
|
|
|
self.invert_temp1_var = IntVar()
|
|
self.invert_temp1 = Checkbutton(self.listFrame, text="",
|
|
variable=self.invert_temp1_var,
|
|
command=self.select_met)
|
|
self.invert_temp1.grid(row=self.num, column=5, sticky=W)
|
|
self.invert_list.append(self.invert_temp1_var)
|
|
|
|
self.invert_temp2_var = IntVar()
|
|
self.invert_temp2 = Checkbutton(self.listFrame, text="",
|
|
variable=self.invert_temp2_var,
|
|
command=self.select_met)
|
|
self.invert_temp2.grid(row=self.num+1, column=5, sticky=W)
|
|
self.invert_list.append(self.invert_temp2_var)
|
|
|
|
self.color_menu_tmp1_var = StringVar()
|
|
self.color_menu_tmp1 = ttk.Combobox(self.listFrame,
|
|
textvariable= \
|
|
self.color_menu_tmp1_var,
|
|
values=globvar_color_options,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.color_menu_tmp1.grid(row=self.num, column=6, sticky=W)
|
|
self.color_menu_tmp1.current(0) # set selection
|
|
self.color_menu_tmp1.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
self.color_list.append(self.color_menu_tmp1_var)
|
|
|
|
self.color_menu_tmp2_var = StringVar()
|
|
self.color_menu_tmp2 = ttk.Combobox(self.listFrame,
|
|
textvariable= \
|
|
self.color_menu_tmp2_var,
|
|
values=globvar_color_options,
|
|
width = globvar_ttk_Combobox,
|
|
state='readonly')
|
|
self.color_menu_tmp2.grid(row=self.num+1, column=6, sticky=W)
|
|
self.color_menu_tmp2.current(0) # set selection
|
|
self.color_menu_tmp2.bind("<<ComboboxSelected>>", self.lost_focus)
|
|
self.color_list.append(self.color_menu_tmp2_var)
|
|
|
|
self.num = int(self.num)+2
|
|
|
|
if self.addtime == 4:
|
|
self.addtime = 0
|
|
Label(self.listFrame, text=" ").grid(row=self.num, sticky=W)
|
|
self.num += 1
|
|
|
|
def deleterow(self):
|
|
if not self.num == 15:
|
|
self.count = 2
|
|
|
|
if self.addtime == 0:
|
|
self.count += 1
|
|
self.addtime = 2
|
|
else:
|
|
self.addtime = 0
|
|
|
|
for numx in range(self.num-self.count, self.num):
|
|
for numy in range(7):
|
|
numwid = len(self.listFrame.grid_slaves(row=numx,
|
|
column=numy))
|
|
if numwid != 0:
|
|
wid = self.listFrame.grid_slaves(row=numx,
|
|
column=numy)
|
|
for numwidindex in range(numwid):
|
|
wid[numwidindex].grid_remove()
|
|
|
|
self.name_list.pop()
|
|
self.thumb_list.pop()
|
|
self.thumb_list.pop()
|
|
self.linefit_list.pop()
|
|
self.linefit_list.pop()
|
|
self.planefit_list.pop()
|
|
self.planefit_list.pop()
|
|
self.invert_list.pop()
|
|
self.invert_list.pop()
|
|
self.c.pop()
|
|
self.color_list.pop()
|
|
|
|
self.num -= self.count
|
|
|
|
|
|
# ________________________________________________________________________ Main
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
print(globvar_console)
|
|
|
|
# Command line: are there any options?
|
|
gui, master_directory, config_file = command_line()
|
|
|
|
# If the GUI shall be started then do so ...
|
|
if gui:
|
|
root = Tk()
|
|
app = MyDialog(root)
|
|
root.update()
|
|
|
|
screen_width = root.winfo_screenwidth()
|
|
screen_height = root.winfo_screenheight()
|
|
window_width = root.winfo_width()
|
|
window_height = root.winfo_height()
|
|
|
|
root.geometry('+%d+%d' % ((screen_width - window_width) / 2,
|
|
(screen_height - window_height) / 2))
|
|
|
|
root.mainloop()
|
|
|
|
# If not, then start AFM_thumbs without GUI and apply it on the master
|
|
# directory with the options described in the config file of AFM_thumbs.
|
|
else:
|
|
|
|
if master_directory != None:
|
|
|
|
start = timer()
|
|
|
|
initialize_and_go(master_directory, config_file)
|
|
|
|
end = timer()
|
|
seconds = timedelta(seconds=end - start)
|
|
time_passed = datetime(1,1,1) + seconds
|
|
print(globvar_timepassed_1 +
|
|
globvar_timepassed_2
|
|
% (time_passed.day-1,
|
|
time_passed.hour,
|
|
time_passed.minute,
|
|
(end - start) % 60))
|
|
|
|
|