Changeset 373:cf2b6b8a3973
- Timestamp:
- 12/18/12 10:08:43 (12 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r349 r373 12 12 "Content-Type: text/plain; charset=utf-8\n" 13 13 "Content-Transfer-Encoding: 8bit\n" 14 15 msgid "secondary" 16 msgstr "Secondary" 14 17 15 18 msgid "aircraft_b736" -
locale/hu/mlx.po
r349 r373 13 13 "Content-Transfer-Encoding: 8bit\n" 14 14 15 msgid "secondary" 16 msgstr "Másodlagos" 17 15 18 msgid "aircraft_b736" 16 19 msgstr "Boeing 737-600" -
mlx.nsi
r28 r373 5 5 6 6 !include "MUI.nsh" 7 !include "nsDialogs.nsh" 8 !include "TextFunc.nsh" 7 9 !include "mlx-common.nsh" 8 10 9 11 ;-------------------------------- 10 12 ;General 13 14 Var ApplicationName 15 16 Function .onInit 17 StrCpy $ApplicationName "Mava Logger X" 18 FunctionEnd 11 19 12 20 ;Name and file … … 17 25 ;Default installation folder 18 26 InstallDir "$PROGRAMFILES\MAVA Logger X" 19 20 ;Get installation folder from registry if available21 InstallDirRegKey HKCU "Software\MAVA Logger X" ""22 27 23 28 ;Vista redirects $SMPROGRAMS to all users without this … … 29 34 Var MUI_TEMP 30 35 Var STARTMENU_FOLDER 36 Var Variable 37 Var Secondary 38 Var Secondary_State 39 Var LinkName 40 Var Parameters 31 41 32 42 ;-------------------------------- … … 40 50 ;Pages 41 51 52 42 53 !insertmacro MUI_PAGE_LICENSE "license.txt" 54 Page custom optionsPage ;optionsPageLeave 43 55 !insertmacro MUI_PAGE_COMPONENTS 44 56 !insertmacro MUI_PAGE_DIRECTORY 45 57 46 58 ;Start Menu Folder Page Configuration 47 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"48 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\MAVA Logger X"49 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"50 59 ;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 60 ;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\MAVA Logger X" 61 ;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" 62 51 63 !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER 52 64 53 65 !insertmacro MUI_PAGE_INSTFILES 54 66 55 67 !insertmacro MUI_UNPAGE_CONFIRM 56 68 !insertmacro MUI_UNPAGE_INSTFILES 57 69 70 Function optionsPage 71 !insertmacro MUI_HEADER_TEXT "Installation Options" "Choose the options for the installation" 72 73 nsDialogs::Create 1018 74 Pop $Variable 75 76 ${If} $Variable == error 77 Abort 78 ${Endif} 79 80 ${NSD_CreateLabel} 0 0 100% 24u "If you select the option below, the program will be installed in a way that it can be used besides another, already existing installation. Read the manual on how to set up this secondary version to avoid conflicting with the primary one." 81 Pop $Variable 82 83 ${NSD_CreateCheckBox} 12 54 100% 12u "Install as secondary" 84 Pop $Secondary 85 ${NSD_SetState} $Secondary $Secondary_State 86 GetFunctionAddress $Variable onSecondaryClicked 87 nsDialogs::onClick $Secondary $Variable 88 89 nsDialogs::Show 90 FunctionEnd 91 92 Function onSecondaryClicked 93 Pop $Secondary 94 ${NSD_GetState} $Secondary $Secondary_State 95 ${If} $Secondary_State == ${BST_CHECKED} 96 StrCpy $INSTDIR "$PROGRAMFILES\MAVA Logger X (Secondary)" 97 StrCpy $STARTMENU_FOLDER "MAVA Logger X (Secondary)" 98 ${Else} 99 StrCpy $INSTDIR "$PROGRAMFILES\MAVA Logger X" 100 StrCpy $STARTMENU_FOLDER "MAVA Logger X" 101 ${EndIf} 102 FunctionEnd 103 58 104 ;-------------------------------- 59 105 ;Languages 60 106 61 107 !insertmacro MUI_LANGUAGE "English" 62 108 … … 67 113 68 114 SetOutPath "$INSTDIR" 69 115 116 ${If} $Secondary_State == ${BST_CHECKED} 117 StrCpy $LinkName "MAVA Logger X (Secondary)" 118 StrCpy $Parameters "secondary" 119 ${Else} 120 StrCpy $LinkName "MAVA Logger X" 121 StrCpy $Parameters "" 122 ${EndIf} 123 70 124 ;ADD YOUR OWN FILES HERE... 71 125 File /r dist\*.* 72 126 73 ;Store installation folder 74 WriteRegStr HKCU "Software\MAVA Logger X" "" $INSTDIR 75 127 ;Create the uninstaller config file 128 ${ConfigWrite} "$INSTDIR\Uninstall.conf" "StartMenuFolder=" "$STARTMENU_FOLDER" $Variable 129 ${ConfigWrite} "$INSTDIR\Uninstall.conf" "LinkName=" "$LinkName" $Variable 130 76 131 ;Create uninstaller 132 77 133 WriteUninstaller "$INSTDIR\Uninstall.exe" 78 134 … … 80 136 ;Create shortcuts 81 137 CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" 82 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MAVA Logger X.lnk" "$INSTDIR\runmlx.exe" 138 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MAVA Logger X.lnk" "$INSTDIR\runmlx.exe" "$Parameters" 83 139 CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" 84 CreateShortCut "$DESKTOP\ MAVA Logger X.lnk" "$INSTDIR\runmlx.exe"140 CreateShortCut "$DESKTOP\$LinkName.lnk" "$INSTDIR\runmlx.exe" "$Parameters" 85 141 !insertmacro MUI_STARTMENU_WRITE_END 86 142 SectionEnd … … 102 158 Section "Uninstall" 103 159 160 ;Read the uninstaller config file 161 ${ConfigRead} "$INSTDIR\Uninstall.conf" "StartMenuFolder=" $MUI_TEMP 162 ${ConfigRead} "$INSTDIR\Uninstall.conf" "LinkName=" $LinkName 163 104 164 RMDir /r "$INSTDIR" 105 165 106 !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP 107 108 Delete "$DESKTOP\MAVA Logger X.lnk" 166 Delete "$DESKTOP\$LinkName.lnk" 109 167 Delete "$SMPROGRAMS\$MUI_TEMP\MAVA Logger X.lnk" 110 168 Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" 111 169 112 170 ;Delete empty start menu parent diretories 113 171 StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" 114 172 115 173 startMenuDeleteLoop: 116 174 ClearErrors 117 175 RMDir $MUI_TEMP 118 176 GetFullPathName $MUI_TEMP "$MUI_TEMP\.." 119 177 120 178 IfErrors startMenuDeleteLoopDone 121 179 122 180 StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop 123 181 startMenuDeleteLoopDone: 124 125 DeleteRegKey /ifempty HKCU "Software\MAVA Logger X"126 182 SectionEnd -
setup.py
r287 r373 39 39 data_files.append((os.path.join("library", path), 40 40 glob(os.path.join(gtkRuntimeDir, path, "*")))) 41 41 42 42 path = os.path.join("share", "locale", "hu", "LC_MESSAGES") 43 43 data_files.append((os.path.join("library", path), … … 46 46 data_files.append((os.path.join("library", path), 47 47 glob(os.path.join(gtkRuntimeDir, path, "*")))) 48 48 49 49 with open("mlx-common.nsh", "wt") as f: 50 50 print >>f, '!define MLX_VERSION "%s"' % (mlx.const.VERSION) … … 81 81 if os.name=="nt": 82 82 mlx.update.buildManifest(os.path.join(scriptdir, "dist")) 83 with open(os.path.join(scriptdir, "dist", "Uninstall.conf")) as f: 84 print >> f, "startMenuFolder=MAVA Logger X" -
src/mlx/config.py
r298 r373 2 2 3 3 import const 4 from util import secondaryInstallation 4 5 5 6 import os 6 7 import sys 8 import traceback 7 9 import ConfigParser 8 10 9 11 ## @package mlx.config 10 # 12 # 11 13 # The handling of the configuration. 12 14 # … … 22 24 23 25 configPath = os.path.join(os.path.expanduser("~"), 24 "mlx.config" if os.name=="nt" else ".mlxrc") 26 "mlx.config" if os.name=="nt" else ".mlxrc") + \ 27 ("-secondary" if secondaryInstallation else "") 25 28 26 29 #------------------------------------------------------------------------------- … … 54 57 """Check if the given hotkey is not equal to the other one.""" 55 58 return not self==other 56 59 57 60 def __str__(self): 58 61 """Construct the hotkey to a string.""" … … 69 72 # The name of the section of the checklists 70 73 SECTION="checklists" 71 74 72 75 @staticmethod 73 76 def fromConfig(config, aircraftType): … … 108 111 """Determine if the checklist is not equal to the given other one.""" 109 112 return not self==other 110 113 111 114 def __len__(self): 112 115 """Get the length of the file list.""" … … 127 130 # The name of the section of the approach callouts 128 131 SECTION="callouts" 129 132 130 133 @staticmethod 131 134 def fromConfig(config, aircraftType): … … 145 148 break 146 149 147 return ApproachCallouts(mapping) 150 return ApproachCallouts(mapping) 148 151 149 152 def __init__(self, mapping = None): … … 211 214 212 215 _messageTypesSection = "messageTypes" 213 216 214 217 def __init__(self): 215 218 """Construct the configuration with default values.""" … … 222 225 self._hideMinimizedWindow = True 223 226 self._quitOnClose = False 224 self._onlineGateSystem = True225 self._onlineACARS = True227 self._onlineGateSystem = not secondaryInstallation 228 self._onlineACARS = not secondaryInstallation 226 229 self._flareTimeFromFS = False 227 230 self._syncFSTime = False … … 232 235 self._pirepDirectory = None 233 236 234 self._enableSounds = True237 self._enableSounds = not secondaryInstallation 235 238 236 239 self._pilotControlsSounds = True … … 242 245 self._enableChecklists = False 243 246 self._checklistHotkey = Hotkey(ctrl = True, shift = True, key = "0") 244 245 self._autoUpdate = True 247 248 self._autoUpdate = True 246 249 self._updateURL = Config.DEFAULT_UPDATE_URL 250 if secondaryInstallation: 251 self._updateURL += "/exp" 247 252 248 253 self._messageTypeLevels = {} … … 253 258 self._checklists[aircraftType] = Checklist() 254 259 self._approachCallouts[aircraftType] = ApproachCallouts() 255 260 256 261 self._modified = False 257 262 … … 315 320 self._hideMinimizedWindow = hideMinimizedWindow 316 321 self._modified = True 317 322 318 323 @property 319 324 def quitOnClose(self): … … 329 334 self._quitOnClose = quitOnClose 330 335 self._modified = True 331 336 332 337 @property 333 338 def onlineGateSystem(self): … … 462 467 return level==const.MESSAGELEVEL_FS or \ 463 468 level==const.MESSAGELEVEL_BOTH 464 469 465 470 def setMessageTypeLevel(self, messageType, level): 466 471 """Set the level of the given message type.""" … … 482 487 self._modified = True 483 488 484 @property 489 @property 485 490 def pilotControlsSounds(self): 486 491 """Get whether the pilot controls the background sounds.""" … … 529 534 self._speedbrakeAtTD = speedbrakeAtTD 530 535 self._modified = True 531 536 532 537 @property 533 538 def enableChecklists(self): … … 600 605 def load(self): 601 606 """Load the configuration from its default location.""" 602 config = ConfigParser.RawConfigParser() 603 config.read(configPath) 607 try: 608 config = ConfigParser.RawConfigParser() 609 config.read(configPath) 610 except: 611 traceback.print_exc() 612 return 604 613 605 614 self._pilotID = self._get(config, "login", "id", "") … … 615 624 self._quitOnClose = self._getBoolean(config, "general", 616 625 "quitOnClose", False) 617 626 618 627 self._onlineGateSystem = self._getBoolean(config, "general", 619 628 "onlineGateSystem", 620 True)629 not secondaryInstallation) 621 630 self._onlineACARS = self._getBoolean(config, "general", 622 "onlineACARS", True) 631 "onlineACARS", 632 not secondaryInstallation) 623 633 self._flareTimeFromFS = self._getBoolean(config, "general", 624 634 "flareTimeFromFS", … … 644 654 self._getMessageTypeLevel(config, messageType) 645 655 646 self._enableSounds = self._getBoolean(config, "sounds", 647 "enable", True)656 self._enableSounds = self._getBoolean(config, "sounds", "enable", 657 not secondaryInstallation) 648 658 self._pilotControlsSounds = self._getBoolean(config, "sounds", 649 659 "pilotControls", True) … … 659 669 self._checklistHotkey.set(self._get(config, "sounds", 660 670 "checklistHotkey", "CS0")) 661 671 662 672 self._autoUpdate = self._getBoolean(config, "update", "auto", True) 663 673 self._updateURL = self._get(config, "update", "url", 664 Config.DEFAULT_UPDATE_URL) 674 Config.DEFAULT_UPDATE_URL + 675 ("/exp" if secondaryInstallation else "")) 665 676 666 677 for aircraftType in const.aircraftTypes: … … 714 725 if messageType in self._messageTypeLevels: 715 726 option = self._getMessageTypeLevelOptionName(messageType) 716 level = self._messageTypeLevels[messageType] 727 level = self._messageTypeLevels[messageType] 717 728 config.set(Config._messageTypesSection, option, 718 729 const.messageLevel2string(level)) … … 733 744 config.set("sounds", "checklistHotkey", 734 745 str(self._checklistHotkey)) 735 746 736 747 config.add_section("update") 737 748 config.set("update", "auto", … … 760 771 if config.has_option(section, option) \ 761 772 else default 762 773 763 774 def _get(self, config, section, option, default): 764 775 """Get the given option as a string, if found in the given config, … … 774 785 value = config.get(Config._messageTypesSection, option) 775 786 return const.string2messageLevel(value) 787 elif secondaryInstallation: 788 return const.MESSAGELEVEL_NONE 776 789 elif messageType in [const.MESSAGETYPE_LOGGER_ERROR, 777 790 const.MESSAGETYPE_FAULT, 778 791 const.MESSAGETYPE_NOGO, 779 792 const.MESSAGETYPE_GATE_SYSTEM, 780 const.MESSAGETYPE_HELP]: 793 const.MESSAGETYPE_HELP]: 781 794 return const.MESSAGELEVEL_BOTH 782 795 else: -
src/mlx/gui/common.py
r362 r373 2 2 import mlx.const as _const 3 3 from mlx.i18n import xstr 4 5 from mlx.util import secondaryInstallation 4 6 5 7 import os … … 262 264 263 265 WINDOW_TITLE_BASE = PROGRAM_NAME + " " + _const.VERSION 266 if secondaryInstallation: 267 WINDOW_TITLE_BASE += " (" + xstr("secondary") + ")" 264 268 265 269 #------------------------------------------------------------------------------ -
src/mlx/mlx.py
r298 r373 3 3 from i18n import setLanguage 4 4 from sound import initializeSound 5 from util import secondaryInstallation 5 6 6 7 import os … … 51 52 52 53 instance.close() 53 os.execv(programPath, args) 54 os.execv(programPath, args) 54 55 55 56 #-------------------------------------------------------------------------------------- … … 60 61 61 62 global instance 62 instance = SingleInstance("mlx", raiseCallbackWrapper) 63 instance = SingleInstance("mlx" + ("-secondary" if secondaryInstallation 64 else ""), raiseCallbackWrapper) 63 65 if not instance: return 64 66 … … 69 71 70 72 if (len(sys.argv)<=1 or sys.argv[1]!="usedeflang") and config.setupLocale(): 71 restart(["usedeflang"] )73 restart(["usedeflang"] + (["secondary"] if secondaryInstallation else [])) 72 74 73 75 setLanguage(programDirectory, config.getLanguage()) 74 76 75 77 from .gui.gui import GUI 76 78 gui = GUI(programDirectory, config) 77 79 78 80 sys.stdout = StdIOHandler(gui) 79 81 sys.stderr = StdIOHandler(gui) -
src/mlx/util.py
r298 r373 2 2 import math 3 3 import time 4 import sys 4 5 5 6 #------------------------------------------------------------------------------ … … 26 27 - the seconds as an integer 27 28 - 1.0 if the value was non-negative, -1.0 if it was negative.""" 28 29 29 30 if degrees<0: 30 31 degrees = -degrees … … 32 33 else: 33 34 mul = 1.0 34 35 35 36 deg = int(degrees) 36 37 min = int((degrees*60.0)%60.0) … … 125 126 126 127 This function calculates the rhumb distance.""" 127 128 128 129 latitude1 = math.radians(latitude1) 129 130 longitude1 = math.radians(longitude1) … … 160 161 return "%.0f metres" % (visibility,) if visibility<10000 \ 161 162 else "%.1f kilometres" % (visibility/1000.0,) 163 164 #------------------------------------------------------------------------------ 165 166 secondaryInstallation="secondary" in sys.argv
Note:
See TracChangeset
for help on using the changeset viewer.