-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fd4e40
commit 8a0d010
Showing
10 changed files
with
1,316 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<html><head><style></style></head><body><h1 id="wikisearch">WikiSearch</h1> | ||
<p>repository: <a href="https://github.com/tecwindow/WikiSearch">https://github.com/tecwindow/WikiSearch</a></p> | ||
<h2 id="program-function-">Program function:</h2> | ||
<p>This simple program enables you to search Wikipedia, the free encyclopedia, without having to open your browser.</p> | ||
<h2 id="features">Features</h2> | ||
<ul> | ||
<li>Look up any article quickly and efficiently.</li> | ||
<li>View the entire article from within the program.</li> | ||
<li>Browse more than one article at a time in separate windows.</li> | ||
<li>Save articles as text files on your PC.</li> | ||
<li>Change the color of the entire frame while reading the article. The next versions will allow further customizations to the colors and fonts.</li> | ||
<li>An auto-updater that allows users quick access to new features.</li> | ||
</ul> | ||
<h2 id="notes-">Notes:</h2> | ||
<ul> | ||
<li>The program is in its first public version. Its concept came to our mind while learning Python. This means that the program may contain some bugs and may not meet all the expectations.</li> | ||
<li>We will constantly update the program to add new features requested by our users. This means that the more a feature is suggested, the quicker it will be implemented.</li> | ||
<li>The program is only available in English at the moment. Support for translations will be implemented in future releases.</li> | ||
<li>You can suggest features via GitHub if you are an English speaker, or contact us via Telegram through the Tech Window channel or through our own accounts. You can access ways to contact us through the help menu within the program.</li> | ||
</ul> | ||
<h2 id="program-developers-">Program developers:</h2> | ||
<ul> | ||
<li>Mahmoud Atef: mahmoud.atef.987123@gmail.com</li> | ||
<li>Mester Perfect: AhmedBakr593@gmail.com</li> | ||
<li>Qais Alrefai: ww258148@gmail.com</li> | ||
<li>TecWindow on Telegram: <a href="https://t.me/TecWindow">https://t.me/TecWindow</a></li> | ||
<li>a2ztec on Telegram: <a href="https://t.me/A2zTecChannel">https://t.me/A2zTecChannel</a></li> | ||
</ul> | ||
</body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
wxpython | ||
nlpia2_wikipedia | ||
pyperclip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#-*- coding: utf-8 -*- | ||
# import project libraries. | ||
import wx | ||
import threading | ||
import requests | ||
from urllib.request import urlopen | ||
import os | ||
import json | ||
import subprocess | ||
|
||
#geting what's new and download ling from online info file. | ||
try: | ||
# url = "https://mx-blind.com/WikiSearch/WikiSearch.json" | ||
url = "https://raw.githubusercontent.com/tecwindow/WikiSearch/main/WikiSearch.json" | ||
response = urlopen(url) | ||
data_json = json.loads(response.read()) | ||
whatIsNew = data_json["What's new"] | ||
DownloadLink = data_json["url"] | ||
except: | ||
pass | ||
|
||
#extracting the name file and geting temp path. | ||
try: | ||
file_name = DownloadLink.split('/')[-1] | ||
temp = os.getenv("temp") | ||
path = str(temp+"/"+file_name) | ||
except: | ||
path = "" | ||
|
||
#Delete setup file if is found in temp. | ||
if os.path.exists(path): | ||
os.remove(path) | ||
|
||
|
||
|
||
#creating update dialog | ||
class UpdateDialog(wx.Dialog): | ||
def __init__(self, parent): | ||
super().__init__(None, title = "there is an update", size=(300, 300)) | ||
self.Center() | ||
self.Maximize(False) | ||
|
||
#creating panel | ||
Panel = wx.Panel(self) | ||
|
||
#creating field to show what's new. | ||
wx.StaticText(Panel, -1, "What's new in this version?", pos=(20,20), size=(170, 30)) | ||
self.WhatsNew = wx.TextCtrl(Panel, -1, value=f"{whatIsNew}", pos=(10,60), size=(250,90)) | ||
|
||
# Creating Buttons | ||
self.Update = wx.Button(Panel, -1, "Update", pos=(20,200), size=(60,30)) | ||
self.Update.SetDefault() | ||
self.Close = wx.Button(Panel, wx.ID_CANCEL, "Cancel", pos=(90,200), size=(60,30)) | ||
|
||
#show the dialog | ||
self.Show() | ||
|
||
#event for update button | ||
self.Update.Bind(wx.EVT_BUTTON, self.OnDownloadUpdate) | ||
|
||
#creating OnDownloadUpdate function to show progress dialog. | ||
def OnDownloadUpdate(self, event): | ||
ProgressDialog = progress_dialog("downloading update", "please wait", maximum=100, parent=self, style=wx.PD_CAN_ABORT) | ||
|
||
|
||
#creating progress dialog | ||
class progress_dialog(wx.ProgressDialog): | ||
def __init__(self, *args, **kwargs): | ||
wx.ProgressDialog.__init__(self, *args, **kwargs) | ||
|
||
self.handle = kwargs["parent"] | ||
|
||
#making downloading function in thread to download update. | ||
threading.Thread(target=self.downloading, daemon=True).start() | ||
|
||
#creating downloading function | ||
def downloading(self): | ||
f = open(path, 'wb') | ||
with requests.get(DownloadLink, stream=True) as r: | ||
downloaded=0 | ||
total = int(r.headers['content-length']) | ||
for i in r.iter_content(chunk_size=1024): | ||
if self.WasCancelled(): | ||
self.Destroy() | ||
f.close() | ||
os.remove(path) | ||
self.handle.Destroy() | ||
return None | ||
downloaded+=len(i) | ||
progress = int((downloaded/total)*100) | ||
f.write(i) | ||
if progress == 100: | ||
f.close() | ||
subprocess.run([path, "/SILENT", "/VERYSILENT", "/SUPPRESSMSGBOXES"]) | ||
self.Update(progress) | ||
|
Oops, something went wrong.