Browse Source

Change gray mode and add a bw mode + small numbers display

Yann Weber 6 years ago
parent
commit
aa0a96e919
2 changed files with 9 additions and 5 deletions
  1. 6
    2
      gte/rpnlib.py
  2. 3
    3
      gte/world.py

+ 6
- 2
gte/rpnlib.py View File

@@ -10,6 +10,7 @@ _op_alias['add'] = '+'
10 10
 _op_alias['sub'] = '-'
11 11
 _op_alias['mul'] = '*'
12 12
 _op_alias['div'] = '/'
13
+_op_alias['mod'] = '%'
13 14
 _op_alias['bin_and'] = '&'
14 15
 _op_alias['bin_or'] = '|'
15 16
 _op_alias['bin_xor'] = '^'
@@ -146,12 +147,15 @@ class RpnSymbol(object):
146 147
         if err:
147 148
             msg = 'Invalid %s : "%s"' % (err_type, value.upper())
148 149
 
149
-    def __str__(self):
150
+    def __str__(self, small=True):
150 151
         ''' @brief Return a string representation of current symbol '''
151 152
         if self.optype == self.OPERATION:
152 153
             return _op_list[self.value][0].__name__.upper()
153 154
         elif self.optype == self.VALUE:
154
-            return '0x%04X' % self.value
155
+            if small:
156
+                return '0x%X' % self.value
157
+            else:
158
+                return '0x%04X' % self.value
155 159
         else:
156 160
             return self.value.upper()
157 161
 

+ 3
- 3
gte/world.py View File

@@ -169,12 +169,12 @@ class LivingTurmit(Turmit):
169 169
                           for i in colorsys.hsv_to_rgb(rand_hue,
170 170
                                                        rand_lvl,
171 171
                                                        rand_val))
172
-        if world._gray:
173
-            #self._col = 255.0
172
+        if world._gray == 'bw':
173
+            self._col = 255.0
174
+        elif world._gray:
174 175
             self._col = tuple(round(i * 255)
175 176
                               for i in colorsys.hsv_to_rgb(rand_hue,1,1))
176 177
             self._col = World.single_rgb2gray(self._col)
177
-        #self._col = (randint(0,255), randint(0, 255), randint(0,255))
178 178
         if color is not None:
179 179
             self._col = color
180 180
         ## @brief @ref World instance

Loading…
Cancel
Save