Skip to content

Commit

Permalink
pycua instead of PyICU
Browse files Browse the repository at this point in the history
  • Loading branch information
javadr committed Apr 10, 2022
1 parent 686af04 commit ae9586d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 20 deletions.
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
1.1.3 - 2022-04-10
-- `PyICU` is replaced by `pyuca` as the latter is more straightforward for Windows' installation.
-- logo.ico for Windows

1.1.2 - 2022-04-08
-- Support for new suffix گذار/گذاری and گزار/گزاری

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ utest: setup

upload: setup upypi utest

compile: ver
nuCompile: ver
nuitka3 --standalone --onefile --linux-onefile-icon=negar/logo.png \
--include-data-file=negar/data/untouchable.dat=data/untouchable.dat -o dist/gui-v$(VER).bin \
--include-data-file=negar/data/untouchable.dat=data/untouchable.dat -o dist/negar-gui-v$(VER).bin \
--output-dir=dist --remove-output --enable-plugin=pyqt5 negar/gui.py
ls -lh dist

pyins: ver
piCompile: ver
rm build/gui/ -rfv
. .negar/bin/activate
pyinstaller -p negar --onefile --add-data negar/data/untouchable.dat:data --noupx negar/gui.py -n gui-v$(VER)
pyinstaller -p negar --onefile --add-data negar/data/untouchable.dat:data --noupx negar/gui.py -n negar-gui-v$(VER)
ls -lh dist

clean: ver
Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ You can get latest stable changes from github server:

## Zip, Tarball

You can grab the latest tarball.
You can download the latest tarball.

### *nix

Get the latest tarball & install:

$ wget https://github.com/shahinism/python-negar/archive/master.tar.gz
$ wget -O python-negar-master.tar.gz https://github.com/shahinism/python-negar/archive/master.tar.gz
$ tar xvzf python-negar-master.tar.gz && cd python-negar-master
$ python setup.py install

Expand All @@ -52,15 +52,10 @@ Decompress it, and run the following command in root directory of `python-negar`

$ python setup.py install

If you coulddn't able to install PyICU, you can download a corresponding whl file from [Unofficial Windows Binaries for Python Extension Packages](https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyicu).
For example, the latest version (as of Apr 2022) for your `32-bit` Windows and `Python3.8` version is `PyICU‑2.8.1‑cp38‑cp38‑win32.whl`.

pip install .\PyICU‑2.8.1‑cp38‑cp38‑win32.whl

#### Requirements
The main class for text editing just relies on Python's standard library but the GUI part needs `PyQt5`, `pyperclip`, and `PyICU`.
The main class for text editing just relies on Python's standard library but the GUI part needs `PyQt5`, `pyperclip`, `pyuca`, `regex`.

$ pip install PyQt5 PyICU pyperclip
$ pip install PyQt5 pyuca pyperclip regex

Usage
======
Expand All @@ -72,6 +67,10 @@ Usage without extra args:
text = "مانند 'همه ی ' که با 'ی' پسوند همراه هستند"
print(PersianEditor(text)) # Done ;)

resutl:

مانند «همه‌ی» که با «ی» پسوند همراه هستند

Enabling extra features/args:

##
Expand Down
2 changes: 1 addition & 1 deletion negar/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

__version__ = "1.1.2"
__version__ = "1.1.3"

LOGO = (Path(__file__).parent.absolute()/"logo.png").as_posix()
DATAFILE = Path(__file__).parent.absolute()/"data/untouchable.dat"
Expand Down
6 changes: 3 additions & 3 deletions negar/gui.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import sys
import icu
from pyuca import Collator
from pathlib import Path
from pyperclip import copy
from PyQt5.QtGui import QIcon, QColor
Expand All @@ -13,7 +13,7 @@
from virastar import PersianEditor, UnTouchable
from constants import __version__, INFO, LOGO

collator = icu.Collator.createInstance(icu.Locale('fa_IR.UTF-8'))
collator = Collator()

class TableModel(QAbstractTableModel):
def __init__(self, data):
Expand Down Expand Up @@ -64,7 +64,7 @@ def __init__(self, parent = None):

def setup_table(self, col=8):
self.table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
data = sorted(list(UnTouchable().get()), key=collator.getSortKey)
data = sorted(list(UnTouchable().get()), key=collator.sort_key)
data = [data[i*col:(i+1)*col] for i in range(int(len(data)//col)+1)]
model = TableModel(data)
self.table.setModel(model)
Expand Down
Binary file added negar/logo.ico
Binary file not shown.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
include_package_data=True,
packages=find_packages() + ['negar'],
install_requires=[
'pyperclip',
'PyICU',
'PyQt5',
'pyperclip',
'pyuca',
'regex'
],
package_dir={'negar': 'negar'},
package_data={'negar/data': ['data/*.dat']},
description="Negar is a spell corrector and Persian text editor",
license="GPL",
keywords="spellcheck Persian editor",
url="http://shahinism.github.com/python-negar",
url="http://github.com/shahinism/python-negar",
entry_points={
'console_scripts': [
'negar = negar.gui:main',
Expand Down

0 comments on commit ae9586d

Please sign in to comment.