diff --git a/LanguageCodes.json b/LanguageCodes.json new file mode 100644 index 0000000..4c4aac6 --- /dev/null +++ b/LanguageCodes.json @@ -0,0 +1,738 @@ +[ + { + "code": "ab", + "name": "Abkhaz" + }, + { + "code": "aa", + "name": "Afar" + }, + { + "code": "af", + "name": "Afrikaans" + }, + { + "code": "ak", + "name": "Akan" + }, + { + "code": "sq", + "name": "Albanian" + }, + { + "code": "am", + "name": "Amharic" + }, + { + "code": "ar", + "name": "Arabic" + }, + { + "code": "an", + "name": "Aragonese" + }, + { + "code": "hy", + "name": "Armenian" + }, + { + "code": "as", + "name": "Assamese" + }, + { + "code": "av", + "name": "Avaric" + }, + { + "code": "ae", + "name": "Avestan" + }, + { + "code": "ay", + "name": "Aymara" + }, + { + "code": "az", + "name": "Azerbaijani" + }, + { + "code": "bm", + "name": "Bambara" + }, + { + "code": "ba", + "name": "Bashkir" + }, + { + "code": "eu", + "name": "Basque" + }, + { + "code": "be", + "name": "Belarusian" + }, + { + "code": "bn", + "name": "Bengali; Bangla" + }, + { + "code": "bh", + "name": "Bihari" + }, + { + "code": "bi", + "name": "Bislama" + }, + { + "code": "bs", + "name": "Bosnian" + }, + { + "code": "br", + "name": "Breton" + }, + { + "code": "bg", + "name": "Bulgarian" + }, + { + "code": "my", + "name": "Burmese" + }, + { + "code": "ca", + "name": "Catalan; Valencian" + }, + { + "code": "ch", + "name": "Chamorro" + }, + { + "code": "ce", + "name": "Chechen" + }, + { + "code": "ny", + "name": "Chichewa; Chewa; Nyanja" + }, + { + "code": "zh", + "name": "Chinese" + }, + { + "code": "cv", + "name": "Chuvash" + }, + { + "code": "kw", + "name": "Cornish" + }, + { + "code": "co", + "name": "Corsican" + }, + { + "code": "cr", + "name": "Cree" + }, + { + "code": "hr", + "name": "Croatian" + }, + { + "code": "cs", + "name": "Czech" + }, + { + "code": "da", + "name": "Danish" + }, + { + "code": "dv", + "name": "Divehi; Dhivehi; Maldivian;" + }, + { + "code": "nl", + "name": "Dutch" + }, + { + "code": "dz", + "name": "Dzongkha" + }, + { + "code": "en", + "name": "English" + }, + { + "code": "eo", + "name": "Esperanto" + }, + { + "code": "et", + "name": "Estonian" + }, + { + "code": "ee", + "name": "Ewe" + }, + { + "code": "fo", + "name": "Faroese" + }, + { + "code": "fj", + "name": "Fijian" + }, + { + "code": "fi", + "name": "Finnish" + }, + { + "code": "fr", + "name": "French" + }, + { + "code": "ff", + "name": "Fula; Fulah; Pulaar; Pular" + }, + { + "code": "gl", + "name": "Galician" + }, + { + "code": "ka", + "name": "Georgian" + }, + { + "code": "de", + "name": "German" + }, + { + "code": "el", + "name": "Greek, Modern" + }, + { + "code": "gn", + "name": "GuaranÃÂ" + }, + { + "code": "gu", + "name": "Gujarati" + }, + { + "code": "ht", + "name": "Haitian; Haitian Creole" + }, + { + "code": "ha", + "name": "Hausa" + }, + { + "code": "he", + "name": "Hebrew (modern)" + }, + { + "code": "hz", + "name": "Herero" + }, + { + "code": "hi", + "name": "Hindi" + }, + { + "code": "ho", + "name": "Hiri Motu" + }, + { + "code": "hu", + "name": "Hungarian" + }, + { + "code": "ia", + "name": "Interlingua" + }, + { + "code": "id", + "name": "Indonesian" + }, + { + "code": "ie", + "name": "Interlingue" + }, + { + "code": "ga", + "name": "Irish" + }, + { + "code": "ig", + "name": "Igbo" + }, + { + "code": "ik", + "name": "Inupiaq" + }, + { + "code": "io", + "name": "Ido" + }, + { + "code": "is", + "name": "Icelandic" + }, + { + "code": "it", + "name": "Italian" + }, + { + "code": "iu", + "name": "Inuktitut" + }, + { + "code": "ja", + "name": "Japanese" + }, + { + "code": "jv", + "name": "Javanese" + }, + { + "code": "kl", + "name": "Kalaallisut, Greenlandic" + }, + { + "code": "kn", + "name": "Kannada" + }, + { + "code": "kr", + "name": "Kanuri" + }, + { + "code": "ks", + "name": "Kashmiri" + }, + { + "code": "kk", + "name": "Kazakh" + }, + { + "code": "km", + "name": "Khmer" + }, + { + "code": "ki", + "name": "Kikuyu, Gikuyu" + }, + { + "code": "rw", + "name": "Kinyarwanda" + }, + { + "code": "ky", + "name": "Kyrgyz" + }, + { + "code": "kv", + "name": "Komi" + }, + { + "code": "kg", + "name": "Kongo" + }, + { + "code": "ko", + "name": "Korean" + }, + { + "code": "ku", + "name": "Kurdish" + }, + { + "code": "kj", + "name": "Kwanyama, Kuanyama" + }, + { + "code": "la", + "name": "Latin" + }, + { + "code": "lb", + "name": "Luxembourgish, Letzeburgesch" + }, + { + "code": "lg", + "name": "Ganda" + }, + { + "code": "li", + "name": "Limburgish, Limburgan, Limburger" + }, + { + "code": "ln", + "name": "Lingala" + }, + { + "code": "lo", + "name": "Lao" + }, + { + "code": "lt", + "name": "Lithuanian" + }, + { + "code": "lu", + "name": "Luba-Katanga" + }, + { + "code": "lv", + "name": "Latvian" + }, + { + "code": "gv", + "name": "Manx" + }, + { + "code": "mk", + "name": "Macedonian" + }, + { + "code": "mg", + "name": "Malagasy" + }, + { + "code": "ms", + "name": "Malay" + }, + { + "code": "ml", + "name": "Malayalam" + }, + { + "code": "mt", + "name": "Maltese" + }, + { + "code": "mi", + "name": "MÄori" + }, + { + "code": "mr", + "name": "Marathi (MarÄá¹ÂhÄ«)" + }, + { + "code": "mh", + "name": "Marshallese" + }, + { + "code": "mn", + "name": "Mongolian" + }, + { + "code": "na", + "name": "Nauru" + }, + { + "code": "nv", + "name": "Navajo, Navaho" + }, + { + "code": "nb", + "name": "Norwegian BokmÃ¥l" + }, + { + "code": "nd", + "name": "North Ndebele" + }, + { + "code": "ne", + "name": "Nepali" + }, + { + "code": "ng", + "name": "Ndonga" + }, + { + "code": "nn", + "name": "Norwegian Nynorsk" + }, + { + "code": "no", + "name": "Norwegian" + }, + { + "code": "ii", + "name": "Nuosu" + }, + { + "code": "nr", + "name": "South Ndebele" + }, + { + "code": "oc", + "name": "Occitan" + }, + { + "code": "oj", + "name": "Ojibwe, Ojibwa" + }, + { + "code": "cu", + "name": "Old Church Slavonic, Church Slavic, Church Slavonic, Old Bulgarian, Old Slavonic" + }, + { + "code": "om", + "name": "Oromo" + }, + { + "code": "or", + "name": "Oriya" + }, + { + "code": "os", + "name": "Ossetian, Ossetic" + }, + { + "code": "pa", + "name": "Panjabi, Punjabi" + }, + { + "code": "pi", + "name": "PÄli" + }, + { + "code": "fa", + "name": "Persian (Farsi)" + }, + { + "code": "pl", + "name": "Polish" + }, + { + "code": "ps", + "name": "Pashto, Pushto" + }, + { + "code": "pt", + "name": "Portuguese" + }, + { + "code": "qu", + "name": "Quechua" + }, + { + "code": "rm", + "name": "Romansh" + }, + { + "code": "rn", + "name": "Kirundi" + }, + { + "code": "ro", + "name": "Romanian, [])" + }, + { + "code": "ru", + "name": "Russian" + }, + { + "code": "sa", + "name": "Sanskrit (Saá¹ská¹›ta)" + }, + { + "code": "sc", + "name": "Sardinian" + }, + { + "code": "sd", + "name": "Sindhi" + }, + { + "code": "se", + "name": "Northern Sami" + }, + { + "code": "sm", + "name": "Samoan" + }, + { + "code": "sg", + "name": "Sango" + }, + { + "code": "sr", + "name": "Serbian" + }, + { + "code": "gd", + "name": "Scottish Gaelic; Gaelic" + }, + { + "code": "sn", + "name": "Shona" + }, + { + "code": "si", + "name": "Sinhala, Sinhalese" + }, + { + "code": "sk", + "name": "Slovak" + }, + { + "code": "sl", + "name": "Slovene" + }, + { + "code": "so", + "name": "Somali" + }, + { + "code": "st", + "name": "Southern Sotho" + }, + { + "code": "es", + "name": "Spanish; Castilian" + }, + { + "code": "su", + "name": "Sundanese" + }, + { + "code": "sw", + "name": "Swahili" + }, + { + "code": "ss", + "name": "Swati" + }, + { + "code": "sv", + "name": "Swedish" + }, + { + "code": "ta", + "name": "Tamil" + }, + { + "code": "te", + "name": "Telugu" + }, + { + "code": "tg", + "name": "Tajik" + }, + { + "code": "th", + "name": "Thai" + }, + { + "code": "ti", + "name": "Tigrinya" + }, + { + "code": "bo", + "name": "Tibetan Standard, Tibetan, Central" + }, + { + "code": "tk", + "name": "Turkmen" + }, + { + "code": "tl", + "name": "Tagalog" + }, + { + "code": "tn", + "name": "Tswana" + }, + { + "code": "to", + "name": "Tonga (Tonga Islands)" + }, + { + "code": "tr", + "name": "Turkish" + }, + { + "code": "ts", + "name": "Tsonga" + }, + { + "code": "tt", + "name": "Tatar" + }, + { + "code": "tw", + "name": "Twi" + }, + { + "code": "ty", + "name": "Tahitian" + }, + { + "code": "ug", + "name": "Uyghur, Uighur" + }, + { + "code": "uk", + "name": "Ukrainian" + }, + { + "code": "ur", + "name": "Urdu" + }, + { + "code": "uz", + "name": "Uzbek" + }, + { + "code": "ve", + "name": "Venda" + }, + { + "code": "vi", + "name": "Vietnamese" + }, + { + "code": "vo", + "name": "Volapük" + }, + { + "code": "wa", + "name": "Walloon" + }, + { + "code": "cy", + "name": "Welsh" + }, + { + "code": "wo", + "name": "Wolof" + }, + { + "code": "fy", + "name": "Western Frisian" + }, + { + "code": "xh", + "name": "Xhosa" + }, + { + "code": "yi", + "name": "Yiddish" + }, + { + "code": "yo", + "name": "Yoruba" + }, + { + "code": "za", + "name": "Zhuang, Chuang" + }, + { + "code": "zu", + "name": "Zulu" + } +] diff --git a/WikiSearch.iss b/WikiSearch.iss new file mode 100644 index 0000000..22b21e8 --- /dev/null +++ b/WikiSearch.iss @@ -0,0 +1,51 @@ +#define MyAppName "WikiSearch" +#define MyAppVersion "1.0.0" +#define MyAppPublisher "Tecwindow" +#define MyAppURL "https://t.me/tecwindow" +#define MyAppExeName "WikiSearch.exe" + +[Setup] +AppName={#myAppName} +AppVersion={#MyAppVersion} +VersionInfoDescription=WikiSearch setup +VersionInfoVersion={#MyAppVersion} +VersionInfoCompany=tecwindow +VersionInfoCopyright=copyright, ©2022; tecwindow +VersionInfoProductName=WikiSearch +VersionInfoProductVersion={#MyAppVersion} +VersionInfoOriginalFileName=WikiSearch_Setup.exe +AppPublisherURL={#MyAppURL} +AppSupportURL={#MyAppURL} +AppUpdatesURL={#MyAppURL} +AppId={{F3679719-7471-4B3A-A60D-A9BF0B44E7B3} + +DefaultDirName={autopf}\{#MyAppName} +DisableProgramGroupPage=yes +; Uncomment the following line to run in non administrative install mode (install for current user only.) +PrivilegesRequired=admin +OutputDir=D:\python\æíßíÈíÏíÇ\dist\ahm +OutputBaseFilename=WikiSearchSetup +Compression=lzma +CloseApplications=force +restartApplications=yes +SolidCompression=yes +WizardStyle=modern + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" + +[Files] +Source: "D:\python\æíßíÈíÏíÇ\dist\WikiSearch\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion +Source: "D:\python\æíßíÈíÏíÇ\dist\WikiSearch\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[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 + diff --git a/WikiSearch.py b/WikiSearch.py new file mode 100644 index 0000000..42b35a8 --- /dev/null +++ b/WikiSearch.py @@ -0,0 +1,168 @@ +#-*- coding: utf-8 -*- +# import project libraries. +import wx +import json +import nlpia2_wikipedia as wikipedia +import threading +import webbrowser +import os +from urllib.request import urlopen +from view_search_dialog import ViewSearch +from update_dialog import UpdateDialog + +# Create app with wx. +app= wx.App() + +# Include List of languages in JSON format. +# Check existence of file before running program. +try: + with open('LanguageCodes.json') as json_file: + data = json.load(json_file) +except FileNotFoundError: + wx.MessageBox("Some required files are missing.", "Error", style=wx.ICON_ERROR) + Exit() + +# Create empty list +name = [] +code = [] + +# Include json file content and add it to list. +for w in data: + name.append(w["name"]) + code.append(w["code"]) + +# information of program +CurrntVersion = 1.0 +ProgramName = "WikiSearch" +ProgramDescription = "With this program, you can search or browse any Wikipedia article. site: https://t.me/tecwindow" + +# Create main window with wx. + +class window(wx.Frame): + def __init__(self): + super().__init__(None, title = ProgramName, size=(400, 335)) + #make window in center. + self.Center() + #make window Minimum size. + self.Maximize(False) + self.EnableMaximizeButton(False) + + + # Creating panel + Panel = wx.Panel(self) + + # Creating ComboBox for languages + wx.StaticText(Panel, -1, "Choose the search language:", pos=(15,70), size=(380, 30)) + self.LanguageSearch = wx.ComboBox(Panel, -1, pos=(15, 100), size=(120, 40), style=wx.CB_READONLY+wx.CB_SORT) + self.LanguageSearch.SetItems(name) + self.LanguageSearch.Selection = 6 + + # Creating search edit + wx.StaticText(Panel, -1, "Enter your search", pos=(160,70), size=(380, 30)) + self.SearchText = wx.TextCtrl(Panel, -1, pos=(160, 100), size=(200, 30)) + + # Creating Buttons + self.StartSearch = wx.Button(Panel, -1, "start search", pos=(10,235), size=(120,30)) + self.StartSearch.SetDefault() + self.StartSearch.Enabled = False + self.Close = wx.Button(Panel, -1, "Close the program", pos=(250,235), size=(120,30)) + + #creating menu bar + menubar = wx.MenuBar() + Help = wx.Menu() + HelpFile = Help.Append(-1, "Help file \tF1") + AboutProgramItem = Help.Append(-1, "About") + ContactMenu = wx.Menu() + TecWindow=ContactMenu.Append(-1, "TecWindow on Telegram") + QaisAlrefai=ContactMenu.Append(-1, "Qais Alrefai on Telegram") + MahmoodAtef=ContactMenu.Append(-1, "mahmoodatef on Telegram") + MesterPerfect = ContactMenu.Append(-1, "MesterPerfect on Telegram") + Help.AppendSubMenu(ContactMenu, "Contact us") + self.CheckForItem = Help.Append(-1, "Check for update") + menubar.Append(Help, "help") + self.SetMenuBar(menubar) + + # Show Main window + self.Show() + + # events for buttons + self.StartSearch.Bind(wx.EVT_BUTTON, self.OnViewSearch) + self.Close.Bind(wx.EVT_BUTTON, self.OnClose) + #events for menu items + self.Bind(wx.EVT_MENU, self.OnAboutProgram, AboutProgramItem) + self.Bind(wx.EVT_MENU, self.OnCheckForItem, self.CheckForItem) + self.Bind(wx.EVT_MENU, lambda event: webbrowser.open_new("https://t.me/TecWindow"), TecWindow) + self.Bind(wx.EVT_MENU, lambda event: webbrowser.open_new("https://t.me/QaisAlrefai"), QaisAlrefai) + self.Bind(wx.EVT_MENU, lambda event: webbrowser.open_new("https://t.me/MahmoodAtef"), MahmoodAtef) + self.Bind(wx.EVT_MENU, lambda event: webbrowser.open_new("https://t.me/MesterPerfect"), MesterPerfect) + self.Bind(wx.EVT_MENU, lambda event: os.startfile("help me.html"), HelpFile) + self.Bind(wx.EVT_CLOSE, self.OnClose) + self.SearchText.Bind(wx.EVT_TEXT, lambda event: check().start()) + + + #creating OnClose function to Close Program. + def OnClose(self, event): + wx.Exit() + + #creating OnAboutProgram function to show information about this program. + def OnAboutProgram(self, event): + wx.MessageBox(F"""{ProgramName} Version {CurrntVersion}. +{ProgramDescription} + This program was developed by: +Ahmed Bakr. +Qais Alrifai. +Mahmoud Atef.""", "About the program") + + #creating OnViewSearch function to show search results + def OnViewSearch(self, event): + #Set language for search + try: + wikipedia.set_lang(code[self.LanguageSearch.GetSelection()]) + except: + wx.MessageBox("there is no internet connection ", "Connection error", style=wx.ICON_ERROR) + return None + + #geting text of search + TextSearch = self.SearchText.Value + #Show dialog of search results + dialog1 = ViewSearch(self, TextSearch) + #start thread function to add search results for list box in dialog. + thread1 = threading.Thread(target=dialog1.OpenThread, daemon=True) + thread1.start() + + #creating function to check for update + def OnCheckForItem(self, event): + #geting the recent version from online info file. + url = "https://raw.githubusercontent.com/tecwindow/WikiSearch/main/WikiSearch.json" + try: + response = urlopen(url) + except: + wx.MessageBox("there is no internet connection ", "Connection error", style=wx.ICON_ERROR) + return None + data_json = json.loads(response.read()) + RecentVersion = float(data_json["version"]) + #Show the update dialog if there is new version. + if RecentVersion > CurrntVersion: + UpdateDialog(self) + #if there is no new version show MessageBox tell that. + else: + wx.MessageBox(f"You are using version {CurrntVersion} which is the latest version.", "No update available") + +# creating thread to disable start search buttion if search edit is empty. +class check(threading.Thread): + def __init__(self): + super(check, self).__init__() + + def run(self): + if main_window.SearchText.IsEmpty(): + main_window.StartSearch.Enabled = False + else: + main_window.StartSearch.Enabled = True + + + + + + +main_window = window() +app.MainLoop() \ No newline at end of file diff --git a/change_theme_dialog.py b/change_theme_dialog.py new file mode 100644 index 0000000..c765cd1 --- /dev/null +++ b/change_theme_dialog.py @@ -0,0 +1,26 @@ +#-*- coding: utf-8 -*- +# import project libraries. +import wx + +colourList = ["Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue", "Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green", "Brown"] + +class ChangeTheme(wx.Dialog): + + def __init__(self): + super().__init__(None, title = "change theme", size=(200, 200)) + self.Center() + self.Maximize(False) + Panel = wx.Panel(self) + wx.StaticText(Panel, -1, "Choose theme", pos=(20,20), size=(80, 30)) + self.ChangeTheme = wx.ComboBox(Panel, -1, pos=(20, 50), size=(140, 40), style=wx.CB_READONLY+wx.CB_SORT) + self.ChangeTheme.SetItems(colourList) + # Create Buttons + self.Change = wx.Button(Panel, -1, "change", pos=(20,100), size=(60,30)) + self.Change.SetDefault() + self.Close = wx.Button(Panel, wx.ID_CANCEL, "Cancel", pos=(90,100), size=(60,30)) + + self.Change.Bind(wx.EVT_BUTTON, self.OnChangeTheme) + + def OnChangeTheme(self, event): + self.EndModal(self.ChangeTheme.Selection) + diff --git a/file_version_info.py b/file_version_info.py new file mode 100644 index 0000000..e5fa819 --- /dev/null +++ b/file_version_info.py @@ -0,0 +1,12 @@ +import pyinstaller_versionfile + +pyinstaller_versionfile.create_versionfile( + output_file="versionfile.txt", + version="1.0", + company_name="TecWindow", + file_description="With this program, you can search or browse any Wikipedia article. site: https://t.me/tecwindow", + internal_name="WikiSearch", + legal_copyright="© My TecWindow Company. All rights reserved.", + original_filename="WikiSearch.exe", + product_name="WikiSearch" +) diff --git a/help me.html b/help me.html new file mode 100644 index 0000000..0f39aa2 --- /dev/null +++ b/help me.html @@ -0,0 +1,29 @@ +
repository: https://github.com/tecwindow/WikiSearch
+This simple program enables you to search Wikipedia, the free encyclopedia, without having to open your browser.
+