コード例 #1
0
ファイル: environ.py プロジェクト: jsantoul/ga
 def set_user_env(reg, parent=None):
     """Set HKCU (current user) environment variables"""
     reg = listdict2envdict(reg)
     types = dict()
     key = OpenKey(HKEY_CURRENT_USER, "Environment")
     for name in reg:
         try:
             _x, types[name] = QueryValueEx(key, name)
         except WindowsError:
             types[name] = REG_EXPAND_SZ
     key = OpenKey(HKEY_CURRENT_USER, "Environment", 0, KEY_SET_VALUE)
     for name in reg:
         SetValueEx(key, name, 0, types[name], reg[name])
     try:
         from win32gui import SendMessageTimeout
         from win32con import (HWND_BROADCAST, WM_SETTINGCHANGE,
                               SMTO_ABORTIFHUNG)
         SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
                            "Environment", SMTO_ABORTIFHUNG, 5000)
     except ImportError:
         QMessageBox.warning(
             parent, _("Warning"),
             _("Module <b>pywin32 was not found</b>.<br>"
               "Please restart this Windows <i>session</i> "
               "(not the computer) for changes to take effect."))
コード例 #2
0
ファイル: configdialog.py プロジェクト: benjello/ga
 def show_message(is_checked):
     if is_checked or not msg_if_enabled:
         if msg_warning is not None:
             QMessageBox.warning(self, self.get_name(),
                                 msg_warning, QMessageBox.Ok)
         if msg_info is not None:
             QMessageBox.information(self, self.get_name(),
                                     msg_info, QMessageBox.Ok)
コード例 #3
0
ファイル: configdialog.py プロジェクト: jsantoul/ga
 def show_message(is_checked):
     if is_checked or not msg_if_enabled:
         if msg_warning is not None:
             QMessageBox.warning(self, self.get_name(), msg_warning,
                                 QMessageBox.Ok)
         if msg_info is not None:
             QMessageBox.information(self, self.get_name(),
                                     msg_info, QMessageBox.Ok)
コード例 #4
0
ファイル: environ.py プロジェクト: Pyke75/ga
 def __init__(self, parent=None):
     super(WinUserEnvDialog, self).__init__(parent)
     self.setup(get_user_env(),
                title="HKEY_CURRENT_USER\Environment", width=600)
     if parent is None:
         parent = self
     QMessageBox.warning(parent, _("Warning"),
                 _("If you accept changes, "
                   "this will modify the current user environment "
                   "variables directly <b>in Windows registry</b>. "
                   "Use it with precautions, at your own risks.<br>"
                   "<br>Note that for changes to take effect, you will "
                   "need to restart the parent process of this applica"
                   "tion (simply restart Openfisca if you have executed it "
                   "from a Windows shortcut, otherwise restart any "
                   "application from which you may have executed it, "
                   "like <i>Python(x,y) Home</i> for example)"))
コード例 #5
0
ファイル: environ.py プロジェクト: jsantoul/ga
 def __init__(self, parent=None):
     super(WinUserEnvDialog, self).__init__(parent)
     self.setup(get_user_env(),
                title="HKEY_CURRENT_USER\Environment",
                width=600)
     if parent is None:
         parent = self
     QMessageBox.warning(
         parent, _("Warning"),
         _("If you accept changes, "
           "this will modify the current user environment "
           "variables directly <b>in Windows registry</b>. "
           "Use it with precautions, at your own risks.<br>"
           "<br>Note that for changes to take effect, you will "
           "need to restart the parent process of this applica"
           "tion (simply restart Openfisca if you have executed it "
           "from a Windows shortcut, otherwise restart any "
           "application from which you may have executed it, "
           "like <i>Python(x,y) Home</i> for example)"))
コード例 #6
0
ファイル: shortcuts.py プロジェクト: benjello/ga
 def check_shortcuts(self):
     """Check shortcuts for conflicts"""
     conflicts = []
     for index, sh1 in enumerate(self.model.shortcuts):
         if index == len(self.model.shortcuts)-1:
             break
         for sh2 in self.model.shortcuts[index+1:]:
             if sh2 is sh1:
                 continue
             if str(sh2.key) == str(sh1.key) \
                and (sh1.context == sh2.context or sh1.context == '_'
                     or sh2.context == '_'):
                 conflicts.append((sh1, sh2))
     if conflicts:
         self.parent().emit(SIGNAL('show_this_page()'))
         cstr = "\n".join(['%s <---> %s' % (sh1, sh2)
                           for sh1, sh2 in conflicts])
         QMessageBox.warning(self, _( "Conflicts"),
                             _("The following conflicts have been "
                               "detected:")+"\n"+cstr, QMessageBox.Ok)
コード例 #7
0
 def check_shortcuts(self):
     """Check shortcuts for conflicts"""
     conflicts = []
     for index, sh1 in enumerate(self.model.shortcuts):
         if index == len(self.model.shortcuts) - 1:
             break
         for sh2 in self.model.shortcuts[index + 1:]:
             if sh2 is sh1:
                 continue
             if str(sh2.key) == str(sh1.key) \
                and (sh1.context == sh2.context or sh1.context == '_'
                     or sh2.context == '_'):
                 conflicts.append((sh1, sh2))
     if conflicts:
         self.parent().emit(SIGNAL('show_this_page()'))
         cstr = "\n".join(
             ['%s <---> %s' % (sh1, sh2) for sh1, sh2 in conflicts])
         QMessageBox.warning(
             self, _("Conflicts"),
             _("The following conflicts have been "
               "detected:") + "\n" + cstr, QMessageBox.Ok)
コード例 #8
0
ファイル: Parameters.py プロジェクト: benjello/ga
    def init_parameters(self):
        '''
        Initialize the parameters of the simulation 
        '''        
        try:
            population_file = CONF.get('paths', 'population_file')         
            store_pop = HDFStore(population_file,'r')                
            self.population_choices = store_pop.keys()
            store_pop.close()

            profiles_file = CONF.get('paths', 'profiles_file')         
            store_prof = HDFStore(profiles_file,'r')
            profiles = store_prof['profiles']
            
            self.set_population_prolong()
            self.set_taxes_proj()
            
        except Exception, e:
            self.population_loaded = False
            QMessageBox.warning(self, u"Impossible de lire les données de population", 
                                u"GA n'a pas réussi à lire les données de population. L'erreur suivante a été renvoyée:\n%s\n\nVous pouvez configuer le chemin vers le fichier de données  Fichier>Paramètres>Chemins>Fichier données population"%e)
            return False
コード例 #9
0
    def init_parameters(self):
        '''
        Initialize the parameters of the simulation 
        '''
        try:
            population_file = CONF.get('paths', 'population_file')
            store_pop = HDFStore(population_file, 'r')
            self.population_choices = store_pop.keys()
            store_pop.close()

            profiles_file = CONF.get('paths', 'profiles_file')
            store_prof = HDFStore(profiles_file, 'r')
            profiles = store_prof['profiles']

            self.set_population_prolong()
            self.set_taxes_proj()

        except Exception, e:
            self.population_loaded = False
            QMessageBox.warning(
                self, u"Impossible de lire les données de population",
                u"GA n'a pas réussi à lire les données de population. L'erreur suivante a été renvoyée:\n%s\n\nVous pouvez configuer le chemin vers le fichier de données  Fichier>Paramètres>Chemins>Fichier données population"
                % e)
            return False
コード例 #10
0
ファイル: environ.py プロジェクト: Pyke75/ga
 def set_user_env(reg, parent=None):
     """Set HKCU (current user) environment variables"""
     reg = listdict2envdict(reg)
     types = dict()
     key = OpenKey(HKEY_CURRENT_USER, "Environment")
     for name in reg:
         try:
             _x, types[name] = QueryValueEx(key, name)
         except WindowsError:
             types[name] = REG_EXPAND_SZ
     key = OpenKey(HKEY_CURRENT_USER, "Environment", 0, KEY_SET_VALUE)
     for name in reg:
         SetValueEx(key, name, 0, types[name], reg[name])
     try:
         from win32gui import SendMessageTimeout
         from win32con import (HWND_BROADCAST, WM_SETTINGCHANGE,
                               SMTO_ABORTIFHUNG)
         SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
                            "Environment", SMTO_ABORTIFHUNG, 5000)
     except ImportError:
         QMessageBox.warning(parent, _("Warning"),
                     _("Module <b>pywin32 was not found</b>.<br>"
                       "Please restart this Windows <i>session</i> "
                       "(not the computer) for changes to take effect."))