-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMikroKam.py
80 lines (55 loc) · 1.87 KB
/
MikroKam.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#! /usr/bin/env python3
"""MikroKam
MikroKam is a Python application using tkinter.
It requires a Raspberry Pi 3 (maybe a 2 will work), a camera
plugged into the CSI port, the Rpi touchscreen and Raspbian.
It only runs on Python 3
version 0.1.0 -- first release, the none tabbed version
version 0.2.0 --
changed file naming to internal counter
moved usb to new module -- flashman
version 0.2.1 -- fixed screen sizes
version 0.2.2 -- working on push problems
version 0.2.3 -- installation script
"""
import threading
from tkinter import Tk, Label, Button, StringVar, FALSE, messagebox
from time import sleep
from tkinter.ttk import Notebook,Frame,LabelFrame
from mainpage import MainPage
import configparser
import datetime
from flashman import FlashMan
root = Tk()
__version__ = '0.2.3'
def is_pi():
"""Detect a Pi, using GPIO module
"""
try:
import RPi.GPIO
return True
except:
return False
def Main():
"""Set up the environment and run the main loop
"""
config = configparser.ConfigParser()
config.read('MikroKam.ini')
ws = root.winfo_screenwidth()
hs = root.winfo_screenheight()
root.title( "MikroKam" )
root.geometry('%dx%d+%d+%d' % ( int(config['app']['screen_width']),
int(config['app']['screen_height']),0,0 ))
root.resizable(width=FALSE,height=FALSE)
mainPage = Frame(root)
mainPage.grid(row=0,column=0)
mainPage.minsize = ws
gui = MainPage( mainPage,config,root )
root.protocol( "WM_DELETE_WINDOW", gui.close )
root.mainloop()
print("we are done")
config['app']['last_run'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
with open('MikroKam.ini','w') as configfile:
config.write(configfile)
if __name__ == "__main__":
Main()