Репозиторий Sisyphus
Последнее обновление: 18 апреля 2021 | Пакетов: 17847 | Посещений: 20748274
en ru br
Репозитории ALT

Группа :: Игры/Прочее
Пакет: fgo

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: port-to-python3.patch
Скачать


diff --git a/fgo/fgo b/fgo/fgo
index 0333953..2f8ca7f 100755
--- a/fgo/fgo
+++ b/fgo/fgo
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 """FGo! - a simple GUI launcher for FlightGear Flight Simulator."""
diff --git a/fgo/src/__init__.py b/fgo/src/__init__.py
index 29fc672..e4de8d9 100644
--- a/fgo/src/__init__.py
+++ b/fgo/src/__init__.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 
 """FGo! - a simple GUI launcher for FlightGear Flight Simulator."""
@@ -7,7 +7,7 @@
 import gettext
 from sys import argv
 from os import chdir
-from Tkinter import Tk
+from tkinter import Tk
 
 
 def early_tk_init():
@@ -20,12 +20,12 @@ def early_tk_init():
 # definition time) because of the constructor's
 # 'font=tkFont.nametofont("TkTextFont")' optional argument.
 root = early_tk_init()
-from config import Config
-from gui.mainwindow import App
-from constants import LOCALE_DIR
+from .config import Config
+from .gui.mainwindow import App
+from .constants import LOCALE_DIR
 
 
-gettext.install('fgo', LOCALE_DIR, unicode=True)
+gettext.install('fgo', LOCALE_DIR)
 
 
 CLI_MESSAGE = """Usage: fgo
@@ -65,7 +65,7 @@ del root, early_tk_init
 
 def promptToNotUseCli():
     if len(argv) > 1:
-        print _(CLI_MESSAGE)
+        print(_(CLI_MESSAGE))
 
 if __name__ == '__main__':
     from sys import path
diff --git a/fgo/src/config.py b/fgo/src/config.py
index c4db282..dc97aa9 100644
--- a/fgo/src/config.py
+++ b/fgo/src/config.py
@@ -5,12 +5,12 @@ import gzip
 import gettext
 import codecs
 import traceback
-from Tkinter import IntVar, StringVar
-from tkMessageBox import showerror
-import tkFont
+from tkinter import IntVar, StringVar
+from tkinter.messagebox import showerror
+import tkinter.font
 
-from gui.infowindow import InfoWindow
-from constants import *
+from .gui.infowindow import InfoWindow
+from .constants import *
 
 
 class Config:
@@ -94,7 +94,7 @@ class Config:
 
     def setTkDefaultFontSize(self):
         """Save unaltered TkDefaultFont size."""
-        size = tkFont.nametofont("TkDefaultFont").actual()["size"]
+        size = tkinter.font.nametofont("TkDefaultFont").actual()["size"]
         self.TkDefaultFontSize.set(size)
 
     def setupFonts(self, init=False):
@@ -123,7 +123,7 @@ class Config:
             return int(round(baseSize * factor))
 
         def configFontSize(style, factor):
-            font = tkFont.nametofont("Tk%sFont" % style)
+            font = tkinter.font.nametofont("Tk%sFont" % style)
             font.configure(size=scale(factor))
 
         # Configure built-in fonts
@@ -137,7 +137,7 @@ class Config:
         # Create or configure custom fonts, depending on 'init'
         aboutTitleFontSize = scale(42 / 18.)
         if init:
-            self.aboutTitleFont = tkFont.Font(
+            self.aboutTitleFont = tkinter.font.Font(
                 family="Helvetica", weight="bold", size=aboutTitleFontSize)
         else:
             self.aboutTitleFont.configure(size=aboutTitleFontSize)
@@ -292,7 +292,7 @@ class Config:
         if not path:
             path = CONFIG
         options = []
-        keys = self.keywords.keys()
+        keys = list(self.keywords.keys())
         keys.sort()
         # Text
         processed_text = []
@@ -319,7 +319,7 @@ class Config:
         for k in keys:
             v = self.keywords[k]
             if v.get() not in ('Default', 'None'):
-                options.append(k + unicode(v.get()))
+                options.append(k + str(v.get()))
 
         s = '\n'.join(options)
 
@@ -350,15 +350,15 @@ class Config:
                         coord_dict[converted] = None
 
         apt_coords = self.readCoord()
-        coords = coord_dict.keys()
+        coords = list(coord_dict.keys())
         res = {}
-        for k, v in apt_coords.items():
+        for k, v in list(apt_coords.items()):
             for c in coords:
                 if v[0] > c[0][0] and v[0] < c[0][1] and \
                    v[1] > c[1][0] and v[1] < c[1][1]:
                     res[k] = None
 
-        res = res.keys()
+        res = list(res.keys())
         res.sort()
         return res
 
@@ -654,7 +654,7 @@ class _ProcessApt:
                 self.close_window()
                 return
             except:
-                print traceback.format_exc()
+                print(traceback.format_exc())
                 self.show_aptdat_general_error()
                 self.close_window()
                 return
diff --git a/fgo/src/constants.py b/fgo/src/constants.py
index fc432cb..c42abed 100644
--- a/fgo/src/constants.py
+++ b/fgo/src/constants.py
@@ -93,4 +93,4 @@ APT_DAT = join('Airports', 'apt.dat.gz')
 METAR_DAT = join('Airports', 'metar.dat.gz')
 
 
-__all__ = tuple(i for i in locals().keys() if i.isupper())
+__all__ = tuple(i for i in list(locals().keys()) if i.isupper())
diff --git a/fgo/src/gui/configwindow.py b/fgo/src/gui/configwindow.py
index b02ff8e..55978ec 100644
--- a/fgo/src/gui/configwindow.py
+++ b/fgo/src/gui/configwindow.py
@@ -2,10 +2,10 @@
 
 
 import os
-from Tkinter import *
-import tkFileDialog as fd
+from tkinter import *
+import tkinter.filedialog as fd
 
-from tooltip import ToolTip
+from .tooltip import ToolTip
 from ..constants import *
 
 
diff --git a/fgo/src/gui/fglauncher.py b/fgo/src/gui/fglauncher.py
index 60d936e..a7ab63e 100644
--- a/fgo/src/gui/fglauncher.py
+++ b/fgo/src/gui/fglauncher.py
@@ -2,9 +2,9 @@
 
 
 import subprocess
-from Tkinter import *
+from tkinter import *
 
-from infowindow import InfoWindow
+from .infowindow import InfoWindow
 
 
 class FGLauncher:
diff --git a/fgo/src/gui/infowindow.py b/fgo/src/gui/infowindow.py
index a61658c..150e512 100644
--- a/fgo/src/gui/infowindow.py
+++ b/fgo/src/gui/infowindow.py
@@ -3,14 +3,14 @@
 
 from string import punctuation
 
-from Tkinter import Toplevel, Label
+from tkinter import Toplevel, Label
 
-import tkFont
+import tkinter.font
 
 class InfoWindow(Toplevel):
 
     def __init__(self, master=None, text=None,
-                 font=tkFont.nametofont("TkHeadingFont"), cnf={}, **kw):
+                 font=tkinter.font.nametofont("TkHeadingFont"), cnf={}, **kw):
         Toplevel.__init__(self, master, cnf, **kw)
         self._window(master, text, font)
 
diff --git a/fgo/src/gui/mainwindow.py b/fgo/src/gui/mainwindow.py
index 53b361e..c002f06 100644
--- a/fgo/src/gui/mainwindow.py
+++ b/fgo/src/gui/mainwindow.py
@@ -6,11 +6,11 @@ import subprocess
 import codecs
 import socket
 from gettext import translation
-from Tkinter import *
-import tkFileDialog as fd
-from ScrolledText import ScrolledText
+from tkinter import *
+import tkinter.filedialog as fd
+from tkinter.scrolledtext import ScrolledText
 from xml.etree.ElementTree import ElementTree
-from tkMessageBox import showerror
+from tkinter.messagebox import showerror
 
 try:
     from PIL import Image, ImageTk
@@ -20,9 +20,9 @@ except ImportError:
     print ('[FGo! Warning] PIL library not found. Aircraft thumbnails '
            'will not be displayed.')
 
-from metar import Metar
-from configwindow import ConfigWindow
-from fglauncher import FGLauncher
+from .metar import Metar
+from .configwindow import ConfigWindow
+from .fglauncher import FGLauncher
 from ..constants import *
 
 
@@ -348,7 +348,7 @@ class App:
             self.aircraftList.insert('end', i)
 
     def buildAirportList(self):
-        L = zip(self.config.airport_icao, self.config.airport_name)
+        L = list(zip(self.config.airport_icao, self.config.airport_name))
         if self.airportList:
             self.airportList.delete(0, 'end')
 
@@ -611,7 +611,7 @@ class App:
             s.send(message)
             s.close()
         except:
-            print _('[FGo! Warning] Scenery prefetch was unsuccessful.')
+            print(_('[FGo! Warning] Scenery prefetch was unsuccessful.'))
 
     def quit(self):
         """Quit application."""
@@ -802,12 +802,12 @@ class App:
                 options[0] = line[7:]
 
         config_in.close()
-        print '\n' + '=' * 80 + '\n'
-        print _('Starting %s with following options:') % options[0]
+        print('\n' + '=' * 80 + '\n')
+        print(_('Starting %s with following options:') % options[0])
 
         for i in options[1:]:
-            print '\t%s' % i
-        print '\n' + '-' * 80 + '\n'
+            print('\t%s' % i)
+        print('\n' + '-' * 80 + '\n')
 
         try:
             launcher = FGLauncher(self.master, options, FG_working_dir)
@@ -840,16 +840,16 @@ class App:
                                              self.config.TS_scenery.get())
             self.TerraSync = subprocess.Popen(options.split())
             self.TerraSync.poll()
-            print '-' * 80
-            print _('Starting TerraSync with following command:')
-            print options
-            print '-' * 80
+            print('-' * 80)
+            print(_('Starting TerraSync with following command:'))
+            print(options)
+            print('-' * 80)
         else:
             try:
                 os.kill(self.TerraSync.pid, 15)
-                print '-' * 80
-                print _('Stopping TerraSync')
-                print '-' * 80
+                print('-' * 80)
+                print(_('Stopping TerraSync'))
+                print('-' * 80)
             except AttributeError:
                 return
 
diff --git a/fgo/src/gui/metar.py b/fgo/src/gui/metar.py
index 3f51021..ffe754a 100644
--- a/fgo/src/gui/metar.py
+++ b/fgo/src/gui/metar.py
@@ -3,9 +3,10 @@
 
 from math import sqrt
 from socket import setdefaulttimeout, timeout
-from urllib2 import Request, URLError, build_opener, HTTPHandler
-from thread import start_new_thread
-from Tkinter import *
+from urllib.request import Request, build_opener, HTTPHandler
+from urllib.error import URLError
+from _thread import start_new_thread
+from tkinter import *
 
 from ..constants import USER_AGENT
 
diff --git a/fgo/src/gui/tooltip.py b/fgo/src/gui/tooltip.py
index 0c52af5..046715f 100644
--- a/fgo/src/gui/tooltip.py
+++ b/fgo/src/gui/tooltip.py
@@ -1,7 +1,7 @@
 """Tooltip widget"""
 
 
-from Tkinter import *
+from tkinter import *
 
 from ..constants import MESSAGE_BG_COL, TOOLTIP_DELAY
 
-- 
2.25.2
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin