diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b1cb160 --- /dev/null +++ b/.gitignore @@ -0,0 +1,161 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + diff --git a/CodeEditor.py b/CodeEditor.py index 17626f8..3ccb835 100644 --- a/CodeEditor.py +++ b/CodeEditor.py @@ -2,6 +2,7 @@ from PyQt6.QtGui import QPainter, QColor from PyQt6.QtCore import Qt, QRect import AlifSyntax +import random ####################################################### تعريف المحرر ################################################## @@ -65,7 +66,8 @@ def PaintEvent(self, event): while block.isValid() and (top <= event.rect().bottom()): if block.isVisible() and (bottom >= event.rect().top()): number = str(blockNumber + 1) - painter.setPen(QColor("#BABABA")) + randcolor = lambda: random.randint(150,200) + painter.setPen(QColor("#%02X%02X%02X" % (randcolor(),randcolor(),randcolor()))) painter.drawText(0, int(top), self.lineNumberArea.width(), height, Qt.AlignmentFlag.AlignRight, number) block = block.next() diff --git a/README.md b/README.md index 70c8e2a..421daa2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,51 @@
- + # محرر طيف | Spectrum IDE -بيئة تطوير لغة ألف 3 + + +
+ + + +
+ +## بيئة تطوير لغة ألف 3 ![SpectrumUI](https://user-images.githubusercontent.com/77246874/129458934-1bd6166e-9f30-445e-ab9b-9a9b6e7b1d21.png) -طريقة التتبيث - +## الاعتماديات + +
+ +
+ +`python3 python3-venv PyQt6` + +
+ +
+ +## طريقة التتبيث + +
+ +> ### على نظام ويندوز + +
+ اولا قم بتثبيت الخطوط المرفقة
@@ -18,6 +57,7 @@ git clone https://github.com/alifcommunity/SpectrumIDEV1 # تغيير دليل العمل الحالي cd SpectrumIDE ``` +
إنشاء بيئة افتراضية (اختياري)
@@ -28,28 +68,88 @@ python3 -m venv venv # تفعيل البيئة الافتراضية في نظام تشغيل ويندوز venv\Scripts\activate.bat +``` + +
+ +تنزيل المكاتب -# تفعيل البيئة الافتراضية في نظام تشغيل لينكس/ماك + +
+ +```bash +# محدث لاخر اصدار pip تاكد ان +pip install --upgrade pip +# تنزيل المكتبات +pip install -r requirements.txt +``` + +
+تشغيل المحرر + +
+ +```bash +python Spectrum.py +``` + +
+ +
+ +> ### على نظام لينكس ` (اوبنتو أو ديبيان او احد بناتها) ` + +
+ +اولا قم بتثبيت الخطوط المرفقة + +
+ +```bash +# استنساخ المشروع من جت هب +git clone https://github.com/alifcommunity/SpectrumIDEV1 + +# تغيير دليل العمل الحالي +cd SpectrumIDE +``` + +
+إنشاء بيئة افتراضية (اختياري) +
+ +```bash +# تنزيل الاعتمادية +apt install python3-venv + +# إنشاء البيئة الافتراضية +python3 -m venv venv + +# تفعيل البيئة الافتراضية في نظام تشغيل لينكس source venv/bin/activate ``` +
تنزيل المكاتب - - + +
```bash -pip3 install -r requirements.txt +# محدث لاخر اصدار pip تاكد ان +pip install --upgrade pip +# تنزيل المكتبات +pip install -r requirements.txt ``` +
-تنفيذ - - +تشغيل المحرر +
- + ```bash -python Spectrum.py +python3 Spectrum.py ``` +
- + diff --git a/Spectrum.py b/Spectrum.py old mode 100644 new mode 100755 index f945a0f..dbd9466 --- a/Spectrum.py +++ b/Spectrum.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + from PyQt6.QtWidgets import QMainWindow, QWidget, QLabel, QPushButton, QHBoxLayout, QVBoxLayout, QFrame, QApplication, QSizeGrip, QFileDialog, QPlainTextEdit from PyQt6.QtCore import QSize, Qt, QPointF, QProcess from PyQt6.QtGui import QIcon, QPixmap, QTextCursor @@ -185,7 +187,7 @@ def __init__(self): self.buildBtn = QPushButton(self.runBtnFrm) self.buildBtn.setToolTip("بناء") - self.buildBtn.setStyleSheet("QPushButton{background-color: #1c1d20; color: rgb(255, 255, 255); border-radius: 7px;}QPushButton:hover{background-color: #FF5733;}QPushButton:pressed{background-color: #323AAF;}") + self.buildBtn.setStyleSheet("QPushButton{background-color: #323AAF; color: rgb(255, 255, 255); border-radius: 7px;}QPushButton:hover{background-color: #FF5733;}QPushButton:pressed{background-color: #323AAF;}") self.buildBtn.setFixedWidth(40) self.buildBtn.setFixedHeight(40) self.buildBtn.setIcon(QIcon("./icons/Build.svg")) diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..fd5231f --- /dev/null +++ b/install.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + + +install_dir="/usr/local/bin" +required_lib="python3-venv" + +read -p "[default n] type y/n to proceed : " inpt +if [[ $inpt == "y" ]]; + then + check="$(apt list | grep -q $required_lib)" + echo "$check" # if return something then do + if $check + then + # create the virtual environment + python3 -m venv venv + # activate it + source venv/bin/activate + # insure pip is upgraded to the latest version inside the environment + pip install --upgrade pip + # installing the component of the editor + pip install -r requirements.txt + # make the file exceutable + chmod +x Spectrum.py + # create a symlink + ln -s $(pwd)/Spectrum.py $HOME/.local/bin/runspectrum + echo "#!/usr/bin/env bash +dir=$(pwd) +source \$dir/venv/bin/activate +runspectrum" > spectrum + chmod +x spectrum + mv spectrum $HOME/.local/bin/ + + echo "installation done successfully" + echo "لقد تمت عملية التنزيل بنجاح " + echo "you can now run spectrum Ide by running the command 'spectrum'" + # run the program + sleep 4s + spectrum + + else + echo "if any errors happens please run the below command" + echo "اذا حدث خطأ اثناء عملية التنزيل الرجاء تنفيذ السطر التالي" + echo "sudo apt install $required_lib" + fi +elif [[ $inpt == "n" ]] + then + echo "installation canceled" +else + echo "y or n has to be entered in order to continue" +fi