Skip to content

Commit

Permalink
Merge branch 'fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokariew committed Nov 29, 2019
2 parents 4f7c3df + 2ee6284 commit 5c6dd3f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 23 deletions.
5 changes: 3 additions & 2 deletions gab.kv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#:kivy 1.10
#:set swidth dp(90)
#:set sheight dp(40)
#:set sfont sp(13)
#:set sfont sp(14)
#:set dark (34/255, 34/255, 34/255, 1)
#:set green (34/255, 139/255, 34/255, 1)
#:set white (1, 1, 1, 1)
Expand Down Expand Up @@ -419,7 +419,8 @@
CLabel:
text: 'T'
CLabel:
text: '\u03A6 \u2090'
text: '\u03A6 [sub]a[/sub]'
markup: True
EWidget
RV:
id: table
Expand Down
48 changes: 31 additions & 17 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
import os
import sys
import webbrowser
from math import isnan
from os import mkdir
from os.path import expanduser, join
import webbrowser

import kivy.resources
import matplotlib as mpl
import numpy as np
from imageio import imsave

from kivy.config import Config

Config.set('kivy', 'exit_on_escape', '0')
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
Config.set('graphics', 'minimum_width', '720')
Config.set('graphics', 'minimum_height', '576')
Config.set('graphics', 'width', '720')
Config.set('graphics', 'height', '576')

import kivy.resources
from kivy.app import App
from kivy.config import Config
from kivy.core.window import Window
from kivy.graphics import ClearBuffers, Fbo, Scale, Translate
from kivy.properties import NumericProperty
Expand All @@ -30,8 +21,16 @@
from kivy.uix.recycleview import RecycleView
from kivy.uix.recycleview.views import RecycleDataViewBehavior
from kivy.uix.screenmanager import Screen, ScreenManager

from maintable import MainTable

Config.set('kivy', 'exit_on_escape', '0')
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
Config.set('graphics', 'minimum_width', '720')
Config.set('graphics', 'minimum_height', '576')
Config.set('graphics', 'width', '720')
Config.set('graphics', 'height', '576')


mpl.use('QT5Agg')

Expand Down Expand Up @@ -173,11 +172,15 @@ def gen_table(self, cols):
self.mag_pop = MagPopup(cols=cols)

def key_action(self, key, keycode, text, modif):
if len(modif) == 1:
if keycode[1] == 'z' and modif[0] == 'ctrl':
if len(modif) >= 1:
print(modif, keycode)
if keycode[1] == 'z' and 'ctrl' in modif:
self.update_label('Undo')
self.table2.undo_changes()
self.update_table()
try:
self.table2.undo_changes()
self.update_table()
except AttributeError:
pass
app = App.get_running_app()
if app.sm.current == 'main' and not self.focus_column == '' and not self.focus_row == '':
if keycode[1] == 'left':
Expand Down Expand Up @@ -343,5 +346,16 @@ def build(self):


if __name__ == '__main__':
import traceback
from datetime import datetime
kivy.resources.resource_add_path(resourcePath())
GabApp().run()
try:
GabApp().run()
except:
app = App.get_running_app()
err_time = datetime.now().isoformat(timespec='minutes').replace(':', '-')
log_name = join(app.main.home, f'log_{err_time}.txt')
with open(log_name, 'w') as log_file:
traceback.print_exc(file=log_file)
raise Exception('Exit found abruptly')
app.main.history()
11 changes: 7 additions & 4 deletions maintable.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ def change_value(self, row, column, value, func=0):
self.analise_input(row, column)

def undo_changes(self):
self.table = self.prev_tables.pop()
self.history_input.pop()
self.vignette = self.table.loc['vignette', 0]
self.LHI = self.table.loc['lhi', 0]
try:
self.table = self.prev_tables.pop()
self.history_input.pop()
self.vignette = self.table.loc['vignette', 0]
self.LHI = self.table.loc['lhi', 0]
except IndexError:
pass

def magnification(self, from_col, to_col, magn, var):
if from_col > to_col:
Expand Down

0 comments on commit 5c6dd3f

Please sign in to comment.