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
|
Description: Fix __setattr__ and __getattr__ for Python 3.3
Python 3.3 sets additional attributes to classes on runtime.This patch
support it.
Author: Koichi Akabe <vbkaisetsu@gmail.com>
Origin: http://bazaar.launchpad.net/~vbkaisetsu/glogic/trunk/revision/91
Forwarded: not-needed
Last-Update: 2020-08-25
--- glogic-2.6.orig/glogic/Preference.py
+++ glogic-2.6/glogic/Preference.py
@@ -5,6 +5,9 @@ from gi.repository import Pango
class _Preference:
def __setattr__(self, name, value):
+ if not name in self.pref_dict:
+ self.__dict__[name] = value
+ return
import cairo
from gi.repository import Pango
if isinstance(self.pref_dict[name], Pango.FontDescription):
@@ -21,7 +24,10 @@ class _Preference:
self.pref_dict[name] = float(value)
def __getattr__(self, name):
- return self.pref_dict[name]
+ try:
+ return self.pref_dict[name]
+ except KeyError:
+ raise AttributeError(name)
pref_dict = {
"drawing_font": Pango.FontDescription("Liberation Mono 10"),
@@ -44,7 +50,7 @@ class _Preference:
"grid_color": cairo.SolidPattern(0.15, 0.15, 0.15),
"symbol_type": 0, # 0: MIL/ANSI 1: IEC
"max_calc_iters": 10000,
- "max_calc_duration": 0.0002
+ "max_calc_duration": 0.0002,
}
def load_settings(self):
|