diff --git a/WikiSearch.iss b/WikiSearch.iss index 10d32f7..4cbb0bd 100644 --- a/WikiSearch.iss +++ b/WikiSearch.iss @@ -1,7 +1,7 @@ #define MyAppName "WikiSearch" -#define MyAppVersion "1.3.0" +#define MyAppVersion "1.4.0" #define MyAppPublisher "Tecwindow" -#define MyAppURL "https://t.me/tecwindow" +#define MyAppURL "https://tecwindow.net/" #define MyAppExeName "WikiSearch.exe" [Setup] @@ -30,7 +30,7 @@ CloseApplications=force restartApplications=yes SolidCompression=yes WizardStyle=modern - +DisableWelcomePage=no [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" Name: "arabic"; MessagesFile: "compiler:Languages\Arabic.isl" @@ -47,16 +47,21 @@ Source: "WikiSearch\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs cr [CustomMessages] arabic.AppLNGfile = Arabic english.AppLNGfile = English -french.AppLNGfile = Français -spanish.AppLNGfile = Español +french.AppLNGfile = French +spanish.AppLNGfile = Spanish [Icons] Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon -[Run] -Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall [INI] Filename: "{userappdata}\WikiSearch\Settingss.ini"; Section: "default"; Key: "language"; String: "{cm:AppLNGfile}" -Filename: "{app}\User Data\Settingss.ini"; Section: "default"; Key: "language"; String: "{cm:AppLNGfile}" \ No newline at end of file +Filename: "{app}\User Data\Settingss.ini"; Section: "default"; Key: "language"; String: "{cm:AppLNGfile}" + +[InstallDelete] +Type: filesandordirs; Name: "{app}" + +[Run] +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall + diff --git a/WikiSearch.py b/WikiSearch.py index 9896581..416d0a1 100644 --- a/WikiSearch.py +++ b/WikiSearch.py @@ -1,5 +1,7 @@ #-*- coding: utf-8 -*- # import project libraries. +from custome_errors import * +sys.excepthook = my_excepthook import wx import json import nlpia2_wikipedia as wikipedia @@ -9,7 +11,7 @@ import os import sys #change working dir to main exe dir -os.chdir(os.path.dirname(sys.argv[0])) +#os.chdir(os.path.dirname(sys.argv[0])) import globals as g from view_search_dialog import ViewSearch from update_dialog import UpdateDialog @@ -19,11 +21,12 @@ from packaging import version from view_search_dialog import * + #Set language for main window _ = SetLanguage(Settings().ReadSettings()) # information of program -CurrntVersion = "1.3.0" +CurrntVersion = "1.4.0" ProgramName = "WikiSearch" ProgramDescription = _("With this program, you can search or browse any Wikipedia article. site: https://github.com/tecwindow/WikiSearch") CurrentSettings = Settings().ReadSettings() @@ -331,8 +334,8 @@ def OnHelp(self, event): language = { "English": "en", "Arabic": "ar", - "Español": "es", - "Français": "fr" + "Spanish": "es", + "French": "fr" } CurrentLanguage = language[CurrentSettings["language"]] diff --git a/custome_errors.py b/custome_errors.py new file mode 100644 index 0000000..cd9264f --- /dev/null +++ b/custome_errors.py @@ -0,0 +1,18 @@ +import traceback +import os +import ctypes +import sys +def my_excepthook(exctype, value, tb): + tb_list = traceback.extract_tb(tb) + error_message = "" + + for tb in tb_list: + file_name = os.path.basename(tb.filename) + line_number = tb.lineno + code = tb.line + + error_message += f"\nFile: {file_name}\nLine: {line_number}\nCode: {code}\n" + + error_message += f"\n{exctype.__name__}: {value}" + + ctypes.windll.user32.MessageBoxW(None, error_message, "Error", 0x10) diff --git a/functions.py b/functions.py index 289e56d..16b75e3 100644 --- a/functions.py +++ b/functions.py @@ -19,8 +19,8 @@ def SetLanguage(CurrentSettings): language = { "English": "en", "Arabic": "ar", - "Español": "es", - "Français": "fr" + "Spanish": "es", + "French": "fr" } try: diff --git a/settings.py b/settings.py index fdf47ae..c4e970a 100644 --- a/settings.py +++ b/settings.py @@ -215,8 +215,15 @@ def __init__(self, parent): #Save Settings function def OnSaveSettings(self, event): + languages = { +"Arabic": "Arabic", +"English": "English", +"Español": "Spanish", +"Français": "French" +} + NewSettings = { - "language": self.ProgramLanguage.Value, + "language": languages[self.ProgramLanguage.Value], "results number": str(self.NumberResults.Value), "random articles number": str(self.random_articles_number.Value), "close message": str(self.VerificationMsg.Value), diff --git a/setup.py b/setup.py index 7d846bd..497c480 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ "packages": ["web_viewer", "view_search_dialog", "view_article_window", "update_dialog", "settings", "my_classes", "functions", "dialogs"], "includes": ["wx", "nlpia2_wikipedia", "pyperclip", "accessible_output2", "mouse", "bs4", "requests", ], "zip_include_packages": ["wx"], -"excludes": ["tkinter", "test", "setuptools", "PyInstaller", "pip"], +"excludes": ["tkinter", "test", "setuptools", "PyInstaller", "pip", "numpy"], "include_msvcr": False } diff --git a/web_viewer.py b/web_viewer.py index c6ef79f..5000e07 100644 --- a/web_viewer.py +++ b/web_viewer.py @@ -87,7 +87,7 @@ def __init__(self, parent, GetValues, handle): #creating web viewer self.ArticleTitle = wx.StaticText(Panel, -1, "please wait:") - self.ViewArticle = wx.html2.WebView.New(Panel, -1) + self.ViewArticle = wx.html2.WebView.New(Panel, -1, name="") self.ViewArticle.SetPage(self.html, "") self.ViewArticle.EnableContextMenu(False) #loading article @@ -420,7 +420,6 @@ def MakeAccessible(self): position = self.ViewArticle.GetPosition() position = self.ViewArticle.ClientToScreen(position) robot.MouseMove(position) - robot.MouseClick(True) mouse.move(100, 100, absolute=False, duration=0.5) mouse.click('left')