import os
import pickle
-import string
import gettext
import logging
import gtk.gdk
import constants
+import hildonize
import unit_data
_moduleLogger = logging.getLogger("gonvert_glade")
PROFILE_STARTUP = False
+FORCE_HILDON_LIKE = True
gettext.bindtextdomain('gonvert', '/usr/share/locale')
gettext.textdomain('gonvert')
return
self._mainWindow = widgets.get_widget('mainWindow')
+ self._app = hildonize.get_app_class()()
+ self._mainWindow = hildonize.hildonize_window(self._app, self._mainWindow)
change_menu_label(widgets, 'fileMenuItem', _('File'))
change_menu_label(widgets, 'exitMenuItem', _('Exit'))
self._unitsView = widgets.get_widget('unitsView')
self._unitsView.set_property('rules_hint', 1)
self._unitsView_selection = self._unitsView.get_selection()
+ if hildonize.IS_HILDON_SUPPORTED or FORCE_HILDON_LIKE:
+ self._unitsView.set_headers_visible(False)
self._unitName = widgets.get_widget('unitName')
self._unitValue = widgets.get_widget('unitValue')
self._previousUnitName = widgets.get_widget('previousUnitName')
self._previousUnitValue = widgets.get_widget('previousUnitValue')
+ if hildonize.IS_HILDON_SUPPORTED or FORCE_HILDON_LIKE:
+ self._previousUnitName.get_parent().hide()
self._unitSymbol = widgets.get_widget('unitSymbol')
self._previousUnitSymbol = widgets.get_widget('previousUnitSymbol')
self._unitDescription = widgets.get_widget('unitDescription')
+ if hildonize.IS_HILDON_SUPPORTED or FORCE_HILDON_LIKE:
+ self._unitDescription.get_parent().get_parent().hide()
self._searchLayout = widgets.get_widget('searchLayout')
self._searchLayout.hide()
if 'size' in saved_window:
a, b = saved_window['size']
self._mainWindow.resize(a, b)
- else:
- #Maximize if no previous size was found
- #self._mainWindow.maximize()
- pass
- else:
- #Maximize if no previous window.dat file was found
- #self._mainWindow.maximize()
- pass
#Restore selections from previously saved settings if it exists and is valid.
historical_catergory_found = False
def _find_first(self):
assert len(self._find_result) == 0
assert self._findIndex == 0
- findString = string.lower(string.strip(self._findEntry.get_text()))
+ findString = self._findEntry.get_text().strip().lower()
if not findString:
return
)
def _find_next(self):
- """
- check if 'new find' or 'last find' or 'next-find'
-
- new-find = run the find algorithm which also selects the first found unit
- = self._findIndex = 0 and self._find_result = []
-
- last-find = restart from top again
- = self._findIndex = len(self._find_result)
-
- next-find = continue to next found location
- = self._findIndex = 0 and len(self._find_result)>0
- """
if len(self._find_result) == 0:
self._find_first()
else:
)
def _find_previous(self):
- """
- check if 'new find' or 'last find' or 'next-find'
-
- new-find = run the find algorithm which also selects the first found unit
- = self._findIndex = 0 and self._find_result = []
-
- last-find = restart from top again
- = self._findIndex = len(self._find_result)
-
- next-find = continue to next found location
- = self._findIndex = 0 and len(self._find_result)>0
- """
if len(self._find_result) == 0:
self._find_first()
else:
buffer = self._unitDescription.get_buffer()
buffer.set_text(unit_spec[2])
self._unitSymbol.set_text(unit_spec[1]) # put units into label text
+ if unit_spec[1]:
+ self._unitSymbol.show()
+ else:
+ self._unitSymbol.hide()
if self._unitValue.get_text() == '':
if self._selectedCategoryName == "Computer Numbers":