def run_(self): control = Control() file = files.readall('/proc/info/fsel') ## Run it ## if file.endswith(".c") or file.endswith('.cpp') or file.endswith( '.cxx') or file.endswith('.c++'): filename = file execname = file.replace('.cpp', '').replace('.cxx', '').replace( '.c++', '').replace('.c', '') files.write( '/tmp/exec.sa', f''' say Compiling {filename} ... cc {filename} echo done echo Running {execname} ... echo {execname} echo echo Finish runing process with exit 0 ... rm /tmp/exec.sa rm {execname} pause ''') self.Env.RunApp('commento', [None]) app.switch('persia') files.remove(execname) elif file.endswith('.py'): # check graphical PyQt5 # if files.readall(file).__contains__( 'from PyQt5') and files.readall(file).__contains__( 'MainApp'): rand = str(random.randint(1000, 9999)) files.create(f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'name[en]', 'Debug App', f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'name[fa]', 'برنامه تستی', f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'logo', '@icon/runner', f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'exec', f"debug_{rand}", f'/usr/share/applications/debug_{rand}.desk') app.switch('persia') py_compile.compile(files.input(file), files.input(f'/usr/app/debug_{rand}.pyc')) self.Env.RunApp(f'debug_{rand}', [None]) app.switch('persia') files.remove(f'/usr/share/applications/debug_{rand}.desk') files.remove(f'/usr/app/debug_{rand}.pyc') else: execname = file.replace('.py', '') files.write( '/tmp/exec.sa', f''' echo Running {execname} ... echo {execname} echo echo Finish runing process with exit 0 ... rm /tmp/exec.sa pause ''') self.Env.RunApp('commento', [None]) app.switch('persia') elif file.endswith('.sa'): execname = file.replace('.sa', '') files.write( '/tmp/exec.sa', f''' echo Running {execname} ... echo {execname} echo echo Finish runing process with exit 0 ... rm /tmp/exec.sa pause ''') self.Env.RunApp('commento', [None]) app.switch('persia') else: app.switch('persia') self.Env.RunApp('text', [res.get('@string/spc'), res.get('@string/spcm')]) app.switch('persia')
from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtWebEngineWidgets import QWebEngineView import os import sys from libabr import Res, Control, Files, System res = Res() control = Control() files = Files() class MainApp(QMainWindow): def Game(self): System('/usr/games/squares') # Run CatBall Game def __init__(self, ports, *args, **kwargs): super(MainApp, self).__init__(*args, **kwargs) self.Backend = ports[0] self.Env = ports[1] self.Widget = ports[2] self.AppName = ports[3] self.External = ports[4] self.Widget.SetWindowTitle(res.get('@string/app_name')) self.Widget.SetWindowIcon(QIcon(res.get(res.etc(self.AppName, "logo")))) self.Widget.Resize(self, self.Env.width(), self.Env.height())
from libabr import Control, Files files = Files() control = Control() locale = control.read_record("locale", "/etc/gui") def get_string(name): return control.read_record(name, f'/srv/com/pyabr/data/{locale}.locale') if locale == 'fa' or locale == 'ar': alignment = 'rtl' else: alignment = 'ltr' style = ''' p { font: menu; font-size: 120%; } ''' print(f''' <html dir='{alignment}'> <head> <title>{get_string('page_not_found')}</title> <style> {style} </style> </head>
cpu = '' cpuc = '' ram = '' ## Configure kernel ############################################################################### ################## Module configure ########################## sys.path.append("usr/app") from libabr import Modules, Files, Control, Colors, Process, Permissions, System, App, Commands, Script ################## Interface configure ########################## modules = Modules() files = Files() control = Control() colors = Colors() process = Process() permissions = Permissions() app = App() commands = Commands() modules.get_modules() ## Find extra packages ## ## @lib/enc ## def uencall(): for i in files.list('/app/packages'): if files.isfile(f'/app/packages/{i}'):
def run_(self): control = Control() file = files.readall('/proc/info/fsel') ## Run it ## if file.endswith(".c") or file.endswith('.cpp') or file.endswith( '.cxx') or file.endswith('.c++'): try: commands.cc([file]) except: self.Env.RunApp('text', [ 'Compile error', 'There is some problem with C/++ Compiler.' ]) self.Env.RunApp('commento', [ file.replace('.cpp', '').replace('.cxx', '').replace( '.c++', '').replace('.c', ''), 'PyPersia Console' ]) files.remove( file.replace('.c', '').replace('.cpp', '').replace('.cxx', '').replace('.c++', '')) elif file.endswith('.py'): # check graphical PyQt5 # if files.readall(file).__contains__( 'from PyQt5') and files.readall(file).__contains__( 'MainApp'): rand = str(random.randint(1000, 9999)) files.create(f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'name[en]', 'Debug App', f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'name[fa]', 'برنامه تستی', f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'logo', '@icon/runner', f'/usr/share/applications/debug_{rand}.desk') control.write_record( 'exec', f"debug_{rand}", f'/usr/share/applications/debug_{rand}.desk') py_compile.compile(files.input(file), files.input(f'/usr/app/debug_{rand}.pyc')) self.Env.RunApp(f'debug_{rand}', [None]) files.remove(f'/usr/share/applications/debug_{rand}.desk') files.remove(f'/usr/app/debug_{rand}.pyc') else: commands.cp([file, '/usr/app/' + files.filename(file)]) self.Env.RunApp('commento', [ files.filename(file.replace('.py', '')), 'PyPersia Console' ]) commands.rm(['/usr/app/' + files.filename(file)]) elif file.endswith('.sa'): self.Env.RunApp('commento', [file.replace('.sa', ''), 'PyPersia Console']) else: self.Env.RunApp('text', [ 'Cannot Support', 'PyPersia cannot support this language or syntax.' ])
# Pyabr (c) 2020 Mani Jamali. GNU General Public License v3.0 # # Programmer & Creator: Mani Jamali <*****@*****.**> # Telegram or Gap channel: @pyabr # Telegram or Gap group: @pyabr_community # Git source: github.com/manijamali2003/pyabr # ####################################################################################### import sys, subprocess from libabr import Files, Control, Permissions, Colors, Process, Modules, Package, Commands, Res modules = Modules() files = Files() control = Control() colors = Colors() process = Process() permissions = Permissions() pack = Package() cmd = Commands() res = Res() ## Check root ## if not permissions.check_root(files.readall("/proc/info/su")): colors.show("paye", "perm", "") sys.exit(0) ## Check inputs ## if sys.argv[1:] == []: colors.show("paye", "fail", "no inputs.")
""" Rachel's Data reader from database Written by -> Mani Jamali github.com/manijamali2003 Rachel's Version -> 0.0.1 Data's Version -> 0.0.1 """ # Use PyAbr Database Extensions from libabr import Files, Control # Read From database files = Files() control = Control() UserName = '' firstname = '' lastname = '' email = '' phone = '' ## Use default Pyabr database ## if files.isfile ('/proc/info/su'): UserName = files.readall('/proc/info/su') firstname = control.read_record('first_name','/etc/users/'+UserName) lastname = control.read_record('last_name', '/etc/users/' + UserName) email = control.read_record('email', '/etc/users/' + UserName) phone = control.read_record('phone', '/etc/users/' + UserName) else: