Skip to content
This repository has been archived by the owner on Aug 8, 2021. It is now read-only.

Commit

Permalink
R-F.E v3
Browse files Browse the repository at this point in the history
  • Loading branch information
ygz213 committed Jul 16, 2021
1 parent b3db5ca commit 4450fe2
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 45 deletions.
20 changes: 12 additions & 8 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from tkinter import *
import scanafile as saf
import options as opo

class main_menu_class():
def __init__(self):
self.main_menu = Tk()
self.main_menu.title('Real-file.extnsn')
self.main_menu.title('Real-file.extnsn (R-F.E v3)')
try:
self.main_menu.wm_iconbitmap('icons/icon.ico')
except:
Expand All @@ -15,12 +16,14 @@ def __init__(self):
self.main_menu.attributes('-fullscreen', True)


def run_scanner():
user = saf.scanner()
user.scanning_widgets()


def main_widgets(self):
def run_scanner():
scanner_user = saf.scanner_class()
scanner_user.scanning_widgets()
def run_settings():
settings_user = opo.options_class()
settings_user.options_widgets()

Button(self.main_menu,
text = 'Scan a file', # "Scan a file" button
font = 11,
Expand All @@ -31,7 +34,7 @@ def main_widgets(self):
activebackground = '#A01A1C',
activeforeground = '#FFF',
relief = 'flat',
command = lambda: main_menu_class.run_scanner()).grid(padx = 37, pady = 14)
command = lambda: run_scanner()).grid(padx = 37, pady = 14)

Button(self.main_menu,
text = 'Options', # "Options" button
Expand All @@ -42,7 +45,8 @@ def main_widgets(self):
fg = '#FFF',
activebackground = '#52467D',
activeforeground = '#FFF',
relief = 'flat').grid(padx = 37, pady = 14)
relief = 'flat',
command = lambda: run_settings()).grid(padx = 37, pady = 14)

self.main_menu.mainloop()

Expand Down
23 changes: 14 additions & 9 deletions app/main_turkish.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from tkinter import *
import scanafile_turkish as saft
import options_turkish as opot

class ana_menü_sınıfı():
def __init__(self):
self.ana_menü = Tk()
self.ana_menü.title('Real-file.extnsn')
self.ana_menü.title('Real-file.extnsn (R-F.E v3)')
try:
self.ana_menü.wm_iconbitmap('icons/icon.ico')
except:
Expand All @@ -15,12 +16,14 @@ def __init__(self):
self.ana_menü.attributes('-fullscreen', True)


def tarayıcıyı_başlat():
kullanıcı = saft.tarayıcı()
kullanıcı.tarama_widgetları()


def ana_widgetlar(self):
def tarayıcıyı_başlat():
tarayıcı_kullanıcısı = saft.tarayıcı_sınıfı()
tarayıcı_kullanıcısı.tarama_widgetları()
def ayarları_başlat():
ayarlar_kullanıcısı = opot.ayarlar_sınıfı()
ayarlar_kullanıcısı.ayarların_widgetları()

Button(self.ana_menü,
text = 'Dosya tarat', # "Dosya tarat" düğmesi
font = 11,
Expand All @@ -31,7 +34,7 @@ def ana_widgetlar(self):
activebackground = '#A01A1C',
activeforeground = '#FFF',
relief = 'flat',
command = lambda: ana_menü_sınıfı.tarayıcıyı_başlat()).grid(padx = 37, pady = 14)
command = lambda: tarayıcıyı_başlat()).grid(padx = 37, pady = 14)

Button(self.ana_menü,
text = 'Ayarlar', # "Ayarlar" düğmesi
Expand All @@ -42,11 +45,13 @@ def ana_widgetlar(self):
fg = '#FFF',
activebackground = '#52467D',
activeforeground = '#FFF',
relief = 'flat').grid(padx = 37, pady = 14)

relief = 'flat',
command = lambda: ayarları_başlat()).grid(padx = 37, pady = 14)

self.ana_menü.mainloop()



if __name__ == '__main__':
kullanıcı = ana_menü_sınıfı()
kullanıcı.ana_widgetlar()
32 changes: 32 additions & 0 deletions app/options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from tkinter import *
from webbrowser import open_new_tab as ont

class options_class():
def __init__(self):
self.options_menu = Tk()
self.options_menu.geometry('600x300')
self.options_menu.resizable(False, False)
self.options_menu.configure(background = '#52467D')
self.options_menu.wm_attributes('-topmost', 1)
self.options_menu.title('Real-file.extnsn (R-F.E v3)')
try:
self.options_menu.wm_iconbitmap('icons/icon.ico')
except:
self.options_menu.wm_iconbitmap('@icons/icon.xbm')


def options_widgets(self):
Label(self.options_menu,
text = 'COMING SOON',
bg = '#52467D',
fg = '#FFF',
font = (None, 18)).pack(pady = 30)
####### (License informations)
Label(self.options_menu, text = ' • Real-file.extnsn is a free software under the MIT license and uses filetype module under the ', bg = '#52467D', fg = 'white').pack(side = 'left')
MIT_link = Label(self.options_menu, text = 'MIT License', fg = 'blue', cursor = 'hand2')
MIT_link.bind("<Button-1>", lambda e: ont('https://github.com/h2non/filetype.py/blob/master/LICENSE'))
MIT_link.pack(side = 'left')
Label(self.options_menu, text = '.', bg = '#52467D', fg = 'white').pack(side = 'left')
#######

self.options_menu.mainloop()
32 changes: 32 additions & 0 deletions app/options_turkish.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from tkinter import *
from webbrowser import open_new_tab as ont

class ayarlar_sınıfı():
def __init__(self):
self.ayarlar_menüsü = Tk()
self.ayarlar_menüsü.geometry('650x300')
self.ayarlar_menüsü.resizable(False, False)
self.ayarlar_menüsü.configure(background = '#52467D')
self.ayarlar_menüsü.wm_attributes('-topmost', 1)
self.ayarlar_menüsü.title('Real-file.extnsn (R-F.E v3)')
try:
self.ayarlar_menüsü.wm_iconbitmap('icons/icon.ico')
except:
self.ayarlar_menüsü.wm_iconbitmap('@icons/icon.xbm')


def ayarların_widgetları(self):
Label(self.ayarlar_menüsü,
text = 'YAKINDA',
bg = '#52467D',
fg = '#FFF',
font = (None, 18)).pack(pady = 30)
####### (Lisans bilgilendirmeleri)
Label(self.ayarlar_menüsü, text = ' • Real-file.extnsn, MIT Lisansı altında özgür bir yazılımdır ve yine', bg = '#52467D', fg = 'white').pack(side = 'left')
MIT_linki = Label(self.ayarlar_menüsü, text = 'MIT Lisansı', fg = 'blue', cursor = 'hand2')
MIT_linki.bind("<Button-1>", lambda e: ont('https://github.com/h2non/filetype.py/blob/master/LICENSE'))
MIT_linki.pack(side = 'left')
Label(self.ayarlar_menüsü, text = 'altında olan filetype modülünü kullanır.', bg = '#52467D', fg = 'white').pack(side = 'left')
#######

self.ayarlar_menüsü.mainloop()
47 changes: 33 additions & 14 deletions app/scanafile.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
from tkinter import *
from tkinter import messagebox
from filetype import guess

class scanner():
class scanner_class():
def __init__(self):
self.scanning_menu = Tk()
self.scanning_menu.geometry('450x300')
self.scanning_menu.resizable(False, False)
self.scanning_menu.configure(background = '#A01A1C')
self.scanning_menu.wm_attributes('-topmost', 1)
self.scanning_menu.title('Real-file.extnsn')
self.scanning_menu.title('Real-file.extnsn (R-F.E v3)')
try:
self.scanning_menu.wm_iconbitmap('icons/icon.ico')
except:
self.scanning_menu.wm_iconbitmap('@icons/icon.xbm')


def scanning_widgets(self):
extension_information = StringVar(self.scanning_menu)
extension_information.set("Paste the file's path.")
Label(self.scanning_menu,
text = "Paste the file's path.", # Information
textvariable = extension_information, # Changeable string
bg = '#A01A1C',
fg = 'white',
height = 3).pack()

Entry(self.scanning_menu,
justify = 'center', # Input box for the file's path
width = 50,
bd = 3,
bg = '#D4C4B7',
highlightthickness = 3,
highlightbackground = '#A01A1C',
highlightcolor = 'black',
selectforeground = 'black',
relief = 'flat').pack(pady = 15)
file_path = Entry(self.scanning_menu,
justify = 'center', # Input box for the file's path
width = 50,
bd = 3,
bg = '#D4C4B7',
highlightthickness = 3,
highlightbackground = '#A01A1C',
highlightcolor = 'black',
selectforeground = 'black',
relief = 'flat')
file_path.pack(pady = 13)

####### (Scanner function)
def scanner():
try:
scanned_file = guess('{}'.format(file_path.get()))
extension_information.set('This file is a {}.'.format(scanned_file.extension.upper()))
except FileNotFoundError:
messagebox.showerror('ERROR', 'No file found.')
except PermissionError:
messagebox.showerror('ERROR', 'Permission denied to access file.')
except AttributeError:
messagebox.showerror('ERROR', "Could not find this file's extension. It may be a text file, you can look at the file after renamed as <filename>.txt")
#######

Button(self.scanning_menu,
text = 'SCAN', # Scanning button
Expand All @@ -39,6 +57,7 @@ def scanning_widgets(self):
width = 10,
bg = '#758E87',
activebackground = '#576863',
relief = 'flat').pack()
relief = 'flat',
command = lambda: scanner()).pack()

self.scanning_menu.mainloop()
47 changes: 33 additions & 14 deletions app/scanafile_turkish.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
from tkinter import *
from tkinter import messagebox
from filetype import guess

class tarayıcı():
class tarayıcı_sınıfı():
def __init__(self):
self.tarama_menüsü = Tk()
self.tarama_menüsü.geometry('450x300')
self.tarama_menüsü.resizable(False, False)
self.tarama_menüsü.configure(background = '#A01A1C')
self.tarama_menüsü.wm_attributes('-topmost', 1)
self.tarama_menüsü.title('Real-file.extnsn')
self.tarama_menüsü.title('Real-file.extnsn (R-F.E v3)')
try:
self.tarama_menüsü.wm_iconbitmap('icons/icon.ico')
except:
self.tarama_menüsü.wm_iconbitmap('@icons/icon.xbm')


def tarama_widgetları(self):
uzantı_bilgilendirmesi = StringVar(self.tarama_menüsü)
uzantı_bilgilendirmesi.set('Taranacak dosyanın yolunu yapıştırın.')
Label(self.tarama_menüsü,
text = 'Taranacak dosyanın yolunu yapıştırın.', # Bilgilendirme
textvariable = uzantı_bilgilendirmesi, # Değişken yazı dizisi
bg = '#A01A1C',
fg = 'white',
height = 3).pack()

Entry(self.tarama_menüsü,
justify = 'center', # Dosya yolu için giri kutusu
width = 50,
bd = 3,
bg = '#D4C4B7',
highlightthickness = 3,
highlightbackground = '#A01A1C',
highlightcolor = 'black',
selectforeground = 'black',
relief = 'flat').pack(pady = 15)
dosya_yolu = Entry(self.tarama_menüsü,
justify = 'center', # Dosya yolu için giri kutusu
width = 50,
bd = 3,
bg = '#D4C4B7',
highlightthickness = 3,
highlightbackground = '#A01A1C',
highlightcolor = 'black',
selectforeground = 'black',
relief = 'flat')
dosya_yolu.pack(pady = 13)

####### (Tarayıcı fonksiyonu)
def tarayıcı():
try:
taranan_dosya = guess('{}'.format(dosya_yolu.get()))
uzantı_bilgilendirmesi.set('Bu dosya bir {}.'.format(taranan_dosya.extension.upper()))
except FileNotFoundError:
messagebox.showerror('HATA', 'Dosya bulunamadı.')
except PermissionError:
messagebox.showerror('HATA', 'Dosyaya erişim reddedildi.')
except AttributeError:
messagebox.showerror('HATA', 'Dosyanın uzantısı bulunamadı. Muhtemelen düz bir metin dosyası (Real-file.extnsn düz metin dosyalarının uzantılarını bulamaz), uzantısını bir .TXT dosyasına çevirerek inceleyebilirsiniz.')
#######

Button(self.tarama_menüsü,
text = 'TARA', # Tarama düğmesi
Expand All @@ -39,6 +57,7 @@ def tarama_widgetları(self):
width = 10,
bg = '#758E87',
activebackground = '#576863',
relief = 'flat').pack()
relief = 'flat',
command = lambda: tarayıcı()).pack()

self.tarama_menüsü.mainloop()

0 comments on commit 4450fe2

Please sign in to comment.