chgksuite 0.26.0b2__py3-none-any.whl → 0.26.0b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chgksuite/cli.py +203 -0
- chgksuite/composer/telegram.py +8 -5
- chgksuite/version.py +1 -1
- {chgksuite-0.26.0b2.dist-info → chgksuite-0.26.0b3.dist-info}/METADATA +4 -2
- {chgksuite-0.26.0b2.dist-info → chgksuite-0.26.0b3.dist-info}/RECORD +9 -9
- {chgksuite-0.26.0b2.dist-info → chgksuite-0.26.0b3.dist-info}/WHEEL +1 -1
- {chgksuite-0.26.0b2.dist-info → chgksuite-0.26.0b3.dist-info}/entry_points.txt +0 -0
- {chgksuite-0.26.0b2.dist-info → chgksuite-0.26.0b3.dist-info}/licenses/LICENSE +0 -0
- {chgksuite-0.26.0b2.dist-info → chgksuite-0.26.0b3.dist-info}/top_level.txt +0 -0
chgksuite/cli.py
CHANGED
|
@@ -12,6 +12,8 @@ from chgksuite.common import (
|
|
|
12
12
|
load_settings,
|
|
13
13
|
)
|
|
14
14
|
from chgksuite.composer import gui_compose
|
|
15
|
+
from chgksuite.handouter.runner import gui_handouter
|
|
16
|
+
from chgksuite.handouter.tex_internals import GREYTEXT_LANGS
|
|
15
17
|
from chgksuite.parser import gui_parse
|
|
16
18
|
from chgksuite.trello import gui_trello
|
|
17
19
|
from chgksuite.version import __version__
|
|
@@ -817,6 +819,205 @@ class ArgparseBuilder:
|
|
|
817
819
|
caption="Не открывать браузер",
|
|
818
820
|
)
|
|
819
821
|
|
|
822
|
+
cmdhandouts = subparsers.add_parser("handouts")
|
|
823
|
+
cmdhandouts_subcommands = cmdhandouts.add_subparsers(dest="handoutssubcommand")
|
|
824
|
+
cmdhandouts_run = self.add_parser(cmdhandouts_subcommands, "run")
|
|
825
|
+
self.add_argument(
|
|
826
|
+
cmdhandouts_run,
|
|
827
|
+
"filename",
|
|
828
|
+
help="file with handouts",
|
|
829
|
+
caption="Имя файла с раздатками",
|
|
830
|
+
filetypes=[("handouts files", "*.hndts"), ("text files", "*.txt")],
|
|
831
|
+
)
|
|
832
|
+
self.add_argument(
|
|
833
|
+
cmdhandouts_run,
|
|
834
|
+
"--lang",
|
|
835
|
+
default="ru",
|
|
836
|
+
argtype="radiobutton",
|
|
837
|
+
choices=sorted(GREYTEXT_LANGS.keys()),
|
|
838
|
+
help="language",
|
|
839
|
+
caption="Язык",
|
|
840
|
+
advanced=True,
|
|
841
|
+
)
|
|
842
|
+
self.add_argument(
|
|
843
|
+
cmdhandouts_run,
|
|
844
|
+
"--compress",
|
|
845
|
+
action="store_true",
|
|
846
|
+
help="compress",
|
|
847
|
+
caption="Сжать файл после вёрстки (требует установленного ghostscript)",
|
|
848
|
+
advanced=True,
|
|
849
|
+
)
|
|
850
|
+
self.add_argument(cmdhandouts_run, "--font", "-f", help="font", caption="Шрифт")
|
|
851
|
+
self.add_argument(
|
|
852
|
+
cmdhandouts_run,
|
|
853
|
+
"--font_size",
|
|
854
|
+
type=int,
|
|
855
|
+
default=14,
|
|
856
|
+
help="font size",
|
|
857
|
+
caption="Размер шрифта",
|
|
858
|
+
)
|
|
859
|
+
self.add_argument(
|
|
860
|
+
cmdhandouts_run,
|
|
861
|
+
"--pdfsettings",
|
|
862
|
+
choices=["screen", "ebook", "printer", "prepress", "default"],
|
|
863
|
+
default="default",
|
|
864
|
+
advanced=True,
|
|
865
|
+
caption="Настройки pdfsettings для ghostscript",
|
|
866
|
+
)
|
|
867
|
+
self.add_argument(
|
|
868
|
+
cmdhandouts_run,
|
|
869
|
+
"--paperwidth",
|
|
870
|
+
type=float,
|
|
871
|
+
default=210,
|
|
872
|
+
help="paper width",
|
|
873
|
+
caption="Ширина бумаги",
|
|
874
|
+
advanced=True,
|
|
875
|
+
)
|
|
876
|
+
self.add_argument(
|
|
877
|
+
cmdhandouts_run,
|
|
878
|
+
"--paperheight",
|
|
879
|
+
type=float,
|
|
880
|
+
default=297,
|
|
881
|
+
help="paper height",
|
|
882
|
+
caption="Высота бумаги",
|
|
883
|
+
advanced=True,
|
|
884
|
+
)
|
|
885
|
+
self.add_argument(
|
|
886
|
+
cmdhandouts_run,
|
|
887
|
+
"--margin_top",
|
|
888
|
+
type=float,
|
|
889
|
+
default=5,
|
|
890
|
+
help="top margin",
|
|
891
|
+
caption="Верхний отступ",
|
|
892
|
+
advanced=True,
|
|
893
|
+
)
|
|
894
|
+
self.add_argument(
|
|
895
|
+
cmdhandouts_run,
|
|
896
|
+
"--margin_bottom",
|
|
897
|
+
type=float,
|
|
898
|
+
default=5,
|
|
899
|
+
help="bottom margin",
|
|
900
|
+
caption="Нижний отступ",
|
|
901
|
+
advanced=True,
|
|
902
|
+
)
|
|
903
|
+
self.add_argument(
|
|
904
|
+
cmdhandouts_run,
|
|
905
|
+
"--margin_left",
|
|
906
|
+
type=float,
|
|
907
|
+
default=5,
|
|
908
|
+
help="left margin",
|
|
909
|
+
caption="Левый отступ",
|
|
910
|
+
advanced=True,
|
|
911
|
+
)
|
|
912
|
+
self.add_argument(
|
|
913
|
+
cmdhandouts_run,
|
|
914
|
+
"--margin_right",
|
|
915
|
+
type=float,
|
|
916
|
+
default=5,
|
|
917
|
+
help="right margin",
|
|
918
|
+
caption="Правый отступ",
|
|
919
|
+
advanced=True,
|
|
920
|
+
)
|
|
921
|
+
self.add_argument(
|
|
922
|
+
cmdhandouts_run,
|
|
923
|
+
"--boxwidth",
|
|
924
|
+
type=float,
|
|
925
|
+
help="box width",
|
|
926
|
+
caption="Ширина блока",
|
|
927
|
+
advanced=True,
|
|
928
|
+
)
|
|
929
|
+
self.add_argument(
|
|
930
|
+
cmdhandouts_run,
|
|
931
|
+
"--boxwidthinner",
|
|
932
|
+
type=float,
|
|
933
|
+
help="box width inner",
|
|
934
|
+
caption="Внутренняя ширина блока",
|
|
935
|
+
advanced=True,
|
|
936
|
+
)
|
|
937
|
+
self.add_argument(
|
|
938
|
+
cmdhandouts_run,
|
|
939
|
+
"--tikz_mm",
|
|
940
|
+
type=float,
|
|
941
|
+
default=2,
|
|
942
|
+
help="tikz_mm width",
|
|
943
|
+
caption="Ширина tikz_mm",
|
|
944
|
+
advanced=True,
|
|
945
|
+
)
|
|
946
|
+
|
|
947
|
+
cmdhandouts_generate = self.add_parser(cmdhandouts_subcommands, "generate")
|
|
948
|
+
self.add_argument(
|
|
949
|
+
cmdhandouts_generate,
|
|
950
|
+
"filename",
|
|
951
|
+
help="file with questions packet",
|
|
952
|
+
caption="Имя файла с пакетом",
|
|
953
|
+
filetypes=[("chgksuite files", "*.4s")],
|
|
954
|
+
)
|
|
955
|
+
self.add_argument(
|
|
956
|
+
cmdhandouts_generate,
|
|
957
|
+
"--lang",
|
|
958
|
+
default="ru",
|
|
959
|
+
help="language",
|
|
960
|
+
caption="Язык",
|
|
961
|
+
argtype="radiobutton",
|
|
962
|
+
choices=sorted(GREYTEXT_LANGS.keys()),
|
|
963
|
+
advanced=True,
|
|
964
|
+
)
|
|
965
|
+
self.add_argument(
|
|
966
|
+
cmdhandouts_generate,
|
|
967
|
+
"--separate",
|
|
968
|
+
action="store_true",
|
|
969
|
+
help="Generate separate handouts for each question",
|
|
970
|
+
caption="Сгенерировать отдельный файл с раздатками для каждого вопроса",
|
|
971
|
+
)
|
|
972
|
+
self.add_argument(
|
|
973
|
+
cmdhandouts_generate,
|
|
974
|
+
"--list-handouts",
|
|
975
|
+
"-l",
|
|
976
|
+
action="store_true",
|
|
977
|
+
help="Generate a file with a list of handouts",
|
|
978
|
+
caption="Сгенерировать файл со списком раздаток",
|
|
979
|
+
)
|
|
980
|
+
|
|
981
|
+
cmdhandouts_pack = self.add_parser(cmdhandouts_subcommands, "pack")
|
|
982
|
+
self.add_argument(
|
|
983
|
+
cmdhandouts_pack,
|
|
984
|
+
"folder",
|
|
985
|
+
help="input directory",
|
|
986
|
+
caption="Папка с раздатками",
|
|
987
|
+
)
|
|
988
|
+
self.add_argument(
|
|
989
|
+
cmdhandouts_pack,
|
|
990
|
+
"--output_filename_prefix",
|
|
991
|
+
"-o",
|
|
992
|
+
default="packed_handouts",
|
|
993
|
+
help="output filename prefix",
|
|
994
|
+
caption="Префикс имени выходного файла",
|
|
995
|
+
)
|
|
996
|
+
self.add_argument(
|
|
997
|
+
cmdhandouts_pack,
|
|
998
|
+
"--n_teams",
|
|
999
|
+
"-n",
|
|
1000
|
+
type=int,
|
|
1001
|
+
required=True,
|
|
1002
|
+
help="number of teams",
|
|
1003
|
+
caption="Количество команд",
|
|
1004
|
+
)
|
|
1005
|
+
self.add_argument(
|
|
1006
|
+
cmdhandouts_pack,
|
|
1007
|
+
"--font",
|
|
1008
|
+
"-f",
|
|
1009
|
+
help="font",
|
|
1010
|
+
caption="Шрифт",
|
|
1011
|
+
)
|
|
1012
|
+
|
|
1013
|
+
cmdhandouts_install = self.add_parser(cmdhandouts_subcommands, "install")
|
|
1014
|
+
self.add_argument(
|
|
1015
|
+
cmdhandouts_install,
|
|
1016
|
+
"--tectonic_package_regex",
|
|
1017
|
+
advanced=True,
|
|
1018
|
+
caption="Переопределить имя файла с релизом tectonic",
|
|
1019
|
+
)
|
|
1020
|
+
|
|
820
1021
|
|
|
821
1022
|
def single_action(args, use_wrapper, resourcedir):
|
|
822
1023
|
if use_wrapper:
|
|
@@ -860,6 +1061,8 @@ def single_action(args, use_wrapper, resourcedir):
|
|
|
860
1061
|
gui_compose(args)
|
|
861
1062
|
if args.action == "trello":
|
|
862
1063
|
gui_trello(args)
|
|
1064
|
+
if args.action == "handouts":
|
|
1065
|
+
gui_handouter(args)
|
|
863
1066
|
|
|
864
1067
|
|
|
865
1068
|
def app():
|
chgksuite/composer/telegram.py
CHANGED
|
@@ -852,7 +852,7 @@ class TelegramExporter(BaseExporter):
|
|
|
852
852
|
|
|
853
853
|
# Wait for a forwarded message with channel information
|
|
854
854
|
channel_id = self.wait_for_forwarded_message(
|
|
855
|
-
entity_type="channel", check_type=True
|
|
855
|
+
entity_type="channel", check_type=True
|
|
856
856
|
)
|
|
857
857
|
if channel_id:
|
|
858
858
|
self.save_username(channel_result, channel_id)
|
|
@@ -875,7 +875,7 @@ class TelegramExporter(BaseExporter):
|
|
|
875
875
|
|
|
876
876
|
# Wait for a forwarded message with chat information
|
|
877
877
|
chat_id = self.wait_for_forwarded_message(
|
|
878
|
-
entity_type="chat", check_type=False
|
|
878
|
+
entity_type="chat", check_type=False
|
|
879
879
|
)
|
|
880
880
|
if not chat_id:
|
|
881
881
|
self.logger.error("Failed to get chat ID from forwarded message")
|
|
@@ -891,7 +891,6 @@ class TelegramExporter(BaseExporter):
|
|
|
891
891
|
entity_type="chat",
|
|
892
892
|
check_type=False,
|
|
893
893
|
add_msg=error_msg,
|
|
894
|
-
string_id=chat_result,
|
|
895
894
|
)
|
|
896
895
|
if chat_id:
|
|
897
896
|
self.save_username(chat_result, chat_id)
|
|
@@ -1117,11 +1116,15 @@ class TelegramExporter(BaseExporter):
|
|
|
1117
1116
|
|
|
1118
1117
|
# Look for a forwarded message in recent messages
|
|
1119
1118
|
cursor = self.db_conn.cursor()
|
|
1119
|
+
if self.created_at:
|
|
1120
|
+
threshold = "'" + self.created_at + "'"
|
|
1121
|
+
else:
|
|
1122
|
+
threshold = "datetime('now', '-2 minutes')"
|
|
1120
1123
|
cursor.execute(
|
|
1121
|
-
"""
|
|
1124
|
+
f"""
|
|
1122
1125
|
SELECT raw_data, created_at
|
|
1123
1126
|
FROM messages
|
|
1124
|
-
WHERE created_at >
|
|
1127
|
+
WHERE created_at > {threshold}
|
|
1125
1128
|
ORDER BY created_at DESC
|
|
1126
1129
|
"""
|
|
1127
1130
|
)
|
chgksuite/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.26.
|
|
1
|
+
__version__ = "0.26.0b3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chgksuite
|
|
3
|
-
Version: 0.26.
|
|
3
|
+
Version: 0.26.0b3
|
|
4
4
|
Summary: A package for chgk automation
|
|
5
5
|
Home-page: https://gitlab.com/peczony/chgksuite
|
|
6
6
|
Author: Alexander Pecheny
|
|
@@ -20,12 +20,14 @@ Requires-Dist: parse
|
|
|
20
20
|
Requires-Dist: Pillow
|
|
21
21
|
Requires-Dist: ply
|
|
22
22
|
Requires-Dist: pypandoc
|
|
23
|
+
Requires-Dist: pypdf
|
|
23
24
|
Requires-Dist: pyperclip
|
|
24
25
|
Requires-Dist: python-docx
|
|
25
26
|
Requires-Dist: python-pptx
|
|
26
|
-
Requires-Dist: requests
|
|
27
27
|
Requires-Dist: python-telegram-bot
|
|
28
|
+
Requires-Dist: requests
|
|
28
29
|
Requires-Dist: toml
|
|
30
|
+
Requires-Dist: watchdog
|
|
29
31
|
Dynamic: author
|
|
30
32
|
Dynamic: author-email
|
|
31
33
|
Dynamic: classifier
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
chgksuite/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
chgksuite/__main__.py,sha256=0-_jfloveTW3SZYW5XEagbyaHKGCiDhGNgcLxsT_dMs,140
|
|
3
|
-
chgksuite/cli.py,sha256=
|
|
3
|
+
chgksuite/cli.py,sha256=cEmcqNq8g7WnGH6gDZbI6UdYlvO_09pdwJYQ3CPqTuw,38647
|
|
4
4
|
chgksuite/common.py,sha256=VkOhoBA_P3qY5VgtvfrBjOsm5uVNL2s2Th2AhGB2pg8,11207
|
|
5
5
|
chgksuite/parser.py,sha256=AVNeTUgv0aGHsxWunV_7bM4Ul2hbDslkzqg0dU49lic,37285
|
|
6
6
|
chgksuite/parser_db.py,sha256=W1--OcDnx18mehH1T2ISHu3Saeq-9mqHo-xJopNySXI,11135
|
|
7
7
|
chgksuite/trello.py,sha256=BG1Qb_W7Uu4o3Mfc_tK71ElU8ysdSplGlj_sAKfvUn4,14730
|
|
8
8
|
chgksuite/typotools.py,sha256=Jdk65Wn_bXqpQtOT7PkBZyD2ZG1MBeeZFPMzcHEPkf4,12771
|
|
9
|
-
chgksuite/version.py,sha256=
|
|
9
|
+
chgksuite/version.py,sha256=0Y7jwTC6PD9RvxUhVxQOyFJAu7Q0Py4Vp602PQLElis,25
|
|
10
10
|
chgksuite/vulture_whitelist.py,sha256=P__p_X0zt10ivddIf81uyxsobV14vFg8uS2lt4foYpc,3582
|
|
11
11
|
chgksuite/composer/__init__.py,sha256=MAOVZIYXmZmD6nNQSo9DueV6b5RgxF7_HGeLvsAhMJs,6490
|
|
12
12
|
chgksuite/composer/chgksuite_parser.py,sha256=MFcLUWbccMqo3OYEuaAIA0loEvWM_PNS9vR7c1z_c60,8843
|
|
@@ -19,7 +19,7 @@ chgksuite/composer/openquiz.py,sha256=4adZewvRXpZhKrh9H4epKoMMDhmki9US55-Q0LcpZW
|
|
|
19
19
|
chgksuite/composer/pptx.py,sha256=BriA-tJyfQwJJtxuq6ppUwdTHtJVlsh_x4Nfo00bBv4,23079
|
|
20
20
|
chgksuite/composer/reddit.py,sha256=-Eg4CqMHhyGGfCteVwdQdtE1pfUXQ42XcP5OYUrBXmo,3878
|
|
21
21
|
chgksuite/composer/stats.py,sha256=GbraSrjaZ8Mc2URs5aGAsI4ekboAKzlJJOqsbe96ELA,3995
|
|
22
|
-
chgksuite/composer/telegram.py,sha256=
|
|
22
|
+
chgksuite/composer/telegram.py,sha256=sVbJFdHTprlDEASvQlOdXgd7tV7xGUOzjCPk1lnBqko,46579
|
|
23
23
|
chgksuite/composer/telegram_bot.py,sha256=xT5D39m4zGmIbHV_ZfyQ9Rc8PAmG2V5FGUeDKpkgyTw,3767
|
|
24
24
|
chgksuite/composer/telegram_parser.py,sha256=50WqOuvzzdMJJm5wsSLS49oURAQRYToPnbPJjQbMYC4,8096
|
|
25
25
|
chgksuite/resources/cheader.tex,sha256=Jfe3LESk0VIV0HCObbajSQpEMljaIDAIEGSs6YY9rTk,3454
|
|
@@ -45,9 +45,9 @@ chgksuite/resources/template.docx,sha256=Do29TAsg3YbH0rRSaXhVzKEoh4pwXkklW_idWA3
|
|
|
45
45
|
chgksuite/resources/template.pptx,sha256=hEFWqE-yYpwZ8ejrMCJIPEyoMT3eDqaqtiEeQ7I4fyk,29777
|
|
46
46
|
chgksuite/resources/template_shorin.pptx,sha256=hEFWqE-yYpwZ8ejrMCJIPEyoMT3eDqaqtiEeQ7I4fyk,29777
|
|
47
47
|
chgksuite/resources/trello.json,sha256=M5Q9JR-AAJF1u16YtNAxDX-7c7VoVTXuq4POTqYvq8o,555
|
|
48
|
-
chgksuite-0.26.
|
|
49
|
-
chgksuite-0.26.
|
|
50
|
-
chgksuite-0.26.
|
|
51
|
-
chgksuite-0.26.
|
|
52
|
-
chgksuite-0.26.
|
|
53
|
-
chgksuite-0.26.
|
|
48
|
+
chgksuite-0.26.0b3.dist-info/licenses/LICENSE,sha256=_a1yfntuPmctLsuiE_08xMSORuCfGS8X5hQph2U_PUw,1081
|
|
49
|
+
chgksuite-0.26.0b3.dist-info/METADATA,sha256=SFprIant-WQagPeKg2p6VBt46U932aqWeYJpJw197U8,1341
|
|
50
|
+
chgksuite-0.26.0b3.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
|
|
51
|
+
chgksuite-0.26.0b3.dist-info/entry_points.txt,sha256=lqjX6ULQZGDt0rgouTXBuwEPiwKkDQkSiNsT877A_Jg,54
|
|
52
|
+
chgksuite-0.26.0b3.dist-info/top_level.txt,sha256=cSWiRBOGZW9nIO6Rv1IrEfwPgV2ZWs87QV9wPXeBGqM,10
|
|
53
|
+
chgksuite-0.26.0b3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|