xython 4.0.7__tar.gz → 4.0.9__tar.gz

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.
Files changed (40) hide show
  1. {xython-4.0.7/src/xython.egg-info → xython-4.0.9}/PKG-INFO +12 -8
  2. {xython-4.0.7 → xython-4.0.9}/setup.py +3 -20
  3. {xython-4.0.7 → xython-4.0.9}/src/xython/__init__.py +1 -1
  4. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_auto.py +86 -10
  5. xython-4.0.9/src/xython/xy_chart.py +199 -0
  6. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_color.py +3 -4
  7. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_common.py +941 -9
  8. xython-4.0.9/src/xython/xy_excel.py +26910 -0
  9. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_hwp.py +12 -10
  10. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_list.py +6 -5
  11. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_map.py +324 -234
  12. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_outlook.py +94 -72
  13. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_re.py +11 -0
  14. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_time.py +28 -26
  15. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_util.py +594 -55
  16. {xython-4.0.7 → xython-4.0.9/src/xython.egg-info}/PKG-INFO +12 -8
  17. {xython-4.0.7 → xython-4.0.9}/src/xython.egg-info/SOURCES.txt +1 -1
  18. xython-4.0.7/src/xython/xy_excel.py +0 -14662
  19. xython-4.0.7/src/xython.egg-info/requires.txt +0 -16
  20. {xython-4.0.7 → xython-4.0.9}/MANIFEST.in +0 -0
  21. {xython-4.0.7 → xython-4.0.9}/README.md +0 -0
  22. {xython-4.0.7 → xython-4.0.9}/requirements.txt +0 -0
  23. {xython-4.0.7 → xython-4.0.9}/setup.cfg +0 -0
  24. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_common_hwp.py +0 -0
  25. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_common_map.py +0 -0
  26. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_db.py +0 -0
  27. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_example.py +0 -0
  28. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_excel_event.py +0 -0
  29. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_grid.py +0 -0
  30. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_grid_model.py +0 -0
  31. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_grid_original.py +0 -0
  32. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_grid_widget.py +0 -0
  33. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_hwp_common.py +0 -0
  34. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_map_common.py +0 -0
  35. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_util2.py +0 -0
  36. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_web.py +0 -0
  37. {xython-4.0.7 → xython-4.0.9}/src/xython/xy_word.py +0 -0
  38. {xython-4.0.7 → xython-4.0.9}/src/xython.egg-info/dependency_links.txt +0 -0
  39. {xython-4.0.7 → xython-4.0.9}/src/xython.egg-info/not-zip-safe +0 -0
  40. {xython-4.0.7 → xython-4.0.9}/src/xython.egg-info/top_level.txt +0 -0
@@ -1,18 +1,24 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: xython
3
- Version: 4.0.7
3
+ Version: 4.0.9
4
4
  Summary: win32com + python + Office Automation = xython, (for easy automation for excel, word, outlook, regex, color, hwp, etc BY python & win32com)
5
5
  Home-page: https://www.xython.co.kr
6
- Author: s.j.park
6
+ Author: sj park
7
7
  Author-email: sjpkorea@naver.com
8
- License: UNKNOWN
9
- Download-URL: https://github.com/sjpark/xython/archive/v4.0.7.tar.gz
10
8
  Project-URL: Documentation, https://sjpkorea.github.io/xython.github.io/
11
9
  Project-URL: Link 1, https://www.xython.co.kr
12
- Platform: UNKNOWN
13
10
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
14
11
  Requires-Python: >=3.8
15
12
  Description-Content-Type: text/markdown
13
+ Dynamic: author
14
+ Dynamic: author-email
15
+ Dynamic: classifier
16
+ Dynamic: description
17
+ Dynamic: description-content-type
18
+ Dynamic: home-page
19
+ Dynamic: project-url
20
+ Dynamic: requires-python
21
+ Dynamic: summary
16
22
 
17
23
 
18
24
  # 4.0.0을 기준으로 각 모듈이름을 변경함 (2025-03-26)
@@ -275,5 +281,3 @@ selenium을 기반으로 사용하기 쉽도록 만든 것
275
281
  | write | 눈에 보이는 것 |
276
282
 
277
283
 
278
-
279
-
@@ -5,27 +5,10 @@ from setuptools import setup, find_packages
5
5
  # long_description = fh.read()
6
6
  setup(
7
7
  name='xython',
8
- version='4.0.7',
8
+ version='4.0.9',
9
9
  url='https://www.xython.co.kr',
10
- install_requires=['pandas',
11
- 'Pillow',
12
- 'pywin32',
13
- 'PySide6',
14
- 'pyperclip',
15
- 'pywinauto',
16
- 'chardet',
17
- 'pygetwindow',
18
- 'psutil',
19
- 'paho-mqtt',
20
- 'korean_lunar_calendar',
21
- 'arrow',
22
- 'folium',
23
- 'webbrowser',
24
- 'selenium',
25
- 'pytest-shutil',
26
- ],
27
- download_url='https://github.com/sjpark/xython/archive/v4.0.7.tar.gz',
28
- author='s.j.park',
10
+ install_requires=[],
11
+ author='sj park',
29
12
  author_email='sjpkorea@naver.com',
30
13
  description="win32com + python + Office Automation = xython, (for easy automation for excel, word, outlook, regex, color, hwp, etc BY python & win32com)",
31
14
  packages=find_packages("src"),
@@ -6,7 +6,7 @@ import inspect
6
6
  import os
7
7
  import sys
8
8
 
9
- __version__ = '4.0.7' #1
9
+ __version__ = '4.0.8' #1
10
10
  real_path = os.path.dirname(os.path.abspath(__file__)).replace("\\","/") #2
11
11
  sys.path.append(real_path)
12
12
 
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import winreg
3
- import win32com.client
4
3
  import win32process
5
4
  import win32con, win32com, win32com.client, win32gui, win32api
5
+ import screeninfo
6
6
 
7
7
  import time, os, math, sys
8
8
  import pyperclip, pywinauto
@@ -14,7 +14,7 @@ from ctypes import wintypes
14
14
  import sounddevice
15
15
  import xy_color, xy_common
16
16
 
17
- import pyaudio, whisper
17
+ import pyaudio
18
18
  import wave
19
19
 
20
20
  from pywinauto import application
@@ -104,7 +104,6 @@ information : 어떤것에대한 이런저런 정보
104
104
 
105
105
  def __init__(self):
106
106
  self.varx = xy_common.xy_common().varx
107
- self.colorx = xy_color.xy_color()
108
107
 
109
108
  def calc_xy_to_angled_xy_in_box(self, x, y, angle, width, height, status):
110
109
  """
@@ -485,14 +484,14 @@ information : 어떤것에대한 이런저런 정보
485
484
  :param xcolor:
486
485
  :return:
487
486
  """
488
-
487
+ colorx = xy_color.xy_color()
489
488
  user32 = ctypes.windll.user32
490
489
  gdi32 = ctypes.windll.gdi32
491
490
  handle = user32.GetDesktopWindow()
492
491
  hdc = user32.GetDC(handle) # 디바이스 컨텍스트 가져오기
493
492
  null_brush = gdi32.GetStockObject(5) # 투명한 브러시 생성
494
- hex_color = self.colorx.change_xcolor_to_rgb(xcolor)
495
- red_pen = gdi32.CreatePen(0, 2, self.colorx.change_rgb_to_hex_rgb(hex_color[0],hex_color[1],hex_color[2])) # 빨간색 펜 생성
493
+ hex_color = colorx.change_xcolor_to_rgb(xcolor)
494
+ red_pen = gdi32.CreatePen(0, 2, colorx.change_rgb_to_hex_rgb(hex_color[0],hex_color[1],hex_color[2])) # 빨간색 펜 생성
496
495
  # 이전 브러시와 펜 저장
497
496
  old_brush = gdi32.SelectObject(hdc, null_brush)
498
497
  old_pen = gdi32.SelectObject(hdc, red_pen)
@@ -2146,12 +2145,13 @@ information : 어떤것에대한 이런저런 정보
2146
2145
  :return:
2147
2146
  """
2148
2147
 
2149
- model = whisper.load_model("large-v2")
2148
+ pass
2149
+ #model = whisper.load_model("large-v2")
2150
2150
  #model = whisper.load_model("small")
2151
2151
  #model = whisper.load_model("base")
2152
- result = model.transcribe(audio_file_name)
2153
- print("음성인식 결과 : ", result["text"])
2154
- return result["text"]
2152
+ #result = model.transcribe(audio_file_name)
2153
+ #print("음성인식 결과 : ", result["text"])
2154
+ #return result["text"]
2155
2155
 
2156
2156
  def write_text_at_cursor(self, input_text):
2157
2157
  """
@@ -2205,3 +2205,79 @@ information : 어떤것에대한 이런저런 정보
2205
2205
  child_window.set_focus()
2206
2206
  child_window.type_keys(text, with_spaces=True)
2207
2207
 
2208
+
2209
+ def get_information_for_secondary_monitor(self):
2210
+ # 부 모니터에 대한 정보를 갖고올 때
2211
+ all_monitors = self.get_information_for_all_monitor()
2212
+ for one in all_monitors:
2213
+ if not one['primary_monitor']:
2214
+ return one
2215
+ return None
2216
+
2217
+
2218
+ def get_information_for_primary_monitor(self):
2219
+ # 주 모니터에 대한 정보를 갖고올 때
2220
+ all_monitors = self.get_information_for_all_monitor()
2221
+ for one in all_monitors:
2222
+ if one['primary_monitor']:
2223
+ return one
2224
+ return None
2225
+
2226
+
2227
+ def screen_capture_for_monitor(self, filename, monitor='primary'):
2228
+ if not filename.endswith('.png'):
2229
+ filename += '.png'
2230
+
2231
+ if monitor == 'primary':
2232
+ screenshot = pyautogui.screenshot()
2233
+ elif monitor == 'secondary':
2234
+ second_monitor = self.get_information_for_secondary_monitor()
2235
+ screenshot = pyautogui.screenshot(region=second_monitor['Monitor'])
2236
+ else:
2237
+ raise ValueError("monitor는 'primary' 또는 'secondary'만 가능합니다.")
2238
+
2239
+ screenshot.save(filename)
2240
+ return filename
2241
+
2242
+
2243
+ def program_is_in_primary_monitor(self, hwnd):
2244
+ # hwnd를 넣으면, primary 모니터에 있는지를 반환하는 것
2245
+ try:
2246
+ rect = win32gui.GetWindowRect(hwnd)
2247
+ center_x = (rect[0] + rect[2]) // 2
2248
+ monitors = screeninfo.get_monitors()
2249
+ print('~~~~~~', monitors)
2250
+ for idx, monitor in enumerate(monitors):
2251
+ if monitor.x <= center_x < monitor.x + monitor.width:
2252
+ return True if idx == 0 else False
2253
+ return 'unknown'
2254
+ except:
2255
+ return 'unknown'
2256
+
2257
+
2258
+ def activate_edge_tab_by_title(self, keyword):
2259
+ # 엣지 웹브라우저의 탭을 선택하는 것
2260
+ try:
2261
+ app = pywinauto.Application(backend="uia").connect(title_re=".*Edge.*", class_name="Chrome_WidgetWin_1")
2262
+ edge_window = app.window(title_re=".*Edge.*", class_name="Chrome_WidgetWin_1")
2263
+ edge_window.set_focus()
2264
+ time.sleep(0.3)
2265
+
2266
+ edge_window.type_keys("^+a") # Ctrl+Shift+A로 검색 열기 (Edge의 웹 검색 기능)
2267
+ time.sleep(0.5)
2268
+
2269
+ # 키워드 입력
2270
+ self.type_letter(keyword)
2271
+ # Enter로 첫 번째 결과 선택
2272
+ self.type_enter()
2273
+
2274
+ except Exception as e:
2275
+ print(f"오류 발생: {e}")
2276
+ return False
2277
+
2278
+
2279
+
2280
+
2281
+
2282
+
2283
+
@@ -0,0 +1,199 @@
1
+ # -*- coding: utf-8 -*-
2
+ import matplotlib.pyplot as plt
3
+ import xy_common
4
+
5
+ class xy_chart:
6
+ def __init__(self):
7
+ self.chart = plt
8
+ self.chart.rc("font", family="Malgun Gothic")
9
+ self.vars = xy_common.xy_common().varx
10
+ self.qty = 0
11
+ self.color_set = ["b", "g", "r", "y", "k", "c", "m"]
12
+ self.line_set = ["solid", "dashed", "dotted", "dashdot"]
13
+ self.marker_set = [".", "o", "v", "x", "s", "*", "+", "d", "|", "_", "h"]
14
+ self.line_datas = []
15
+
16
+ def legend(self, x_position0to1=None, y_position0to1=None):
17
+ #self.chart.legend()
18
+ # plt.legend(loc=(0.0, 0.0))
19
+ # plt.legend(loc=(0.5, 0.5))
20
+ self.chart.legend(loc=(1.0, 1.0))
21
+ #self.chart.legend(loc='best') # ncol = 1
22
+ # plt.legend(loc='best', ncol=2) # ncol = 2
23
+ # plt.legend(loc='best', ncol=2, fontsize=14, frameon=True, shadow=True)
24
+
25
+ def set_x_range(self, xmin, xmax):
26
+ """
27
+ X축의 범위: [xmin, xmax]
28
+ """
29
+ self.chart.xlim([xmin, xmax])
30
+
31
+ def set_y_range(self, ymin, ymax):
32
+ """
33
+ y축의 범위: [ymin, ymax]
34
+ """
35
+ self.chart.ylim([ymin, ymax])
36
+
37
+ def set_xtick(self, input_list):
38
+ """
39
+
40
+ :param input_list:
41
+ :return:
42
+ """
43
+ self.chart.xticks(input_list[0], input_list[1])
44
+
45
+ def set_ytick(self, input_list):
46
+ """
47
+
48
+ :param input_list:
49
+ :return:
50
+ """
51
+ self.chart.yticks(input_list[0], input_list[1])
52
+
53
+ def set_title(self, input_text):
54
+ self.chart.title(input_text)
55
+
56
+ def ytitle(self, input_value=""):
57
+ self.chart.ylabel(input_value)
58
+
59
+ def xtitle(self, input_value=""):
60
+ self.chart.xlabel(input_value)
61
+
62
+
63
+ def line_one(self, x_l1d, y_l1d, color=None, width=None, line_style=None, marker=None, maker_size=None, label=None):
64
+ """
65
+ 한개의 선을 만드는 것이다
66
+
67
+ :param x_data: x 좌표자료
68
+ :param y_data: y 좌표자료
69
+ :param color: 색, auto_unique를 사용하면, 기본으로 정한 색을 순서대로 하나씩 가져와서 사용한다
70
+ :param width: 선의 넓이
71
+ :param line_style: 선의 종류 (점선, 실선...)
72
+ :param marker: 마커의 종류
73
+ :param maker_size: 마커크기
74
+ :param label: 레이블이름
75
+ :return:
76
+ """
77
+
78
+ self.general_line_one(x_l1d, y_l1d, color, width, line_style, marker, maker_size, None, label, True, None)
79
+
80
+ def general_line_one(self, x_l1d, y_l1d, color=None, width=None, line_style=None, alpha=None, marker=None, maker_size=None, marker_inside_color=None, label=None, antialiased=True, zorder=None):
81
+ """
82
+ 한개의 선을 만드는 것이다
83
+
84
+ :param x_data: x 좌표자료
85
+ :param y_data: y 좌표자료
86
+ :param color: 색, auto_unique를 사용하면, 기본으로 정한 색을 순서대로 하나씩 가져와서 사용한다
87
+ :param width: 선의 넓이
88
+ :param line_style: 선의 종류 (점선, 실선...)
89
+ :param alpha: 투명도 (0 ~ 1)
90
+ :param marker: 마커의 종류
91
+ :param maker_size: 마커크기
92
+ :param marker_inside_color: 마커의 내부색
93
+ :param label: 레이블이름
94
+ :param antialiased: 선의 경계를 부드럽게 처리할지, 기본값은 True
95
+ :param zorder: 선이 곂쳤을때 어느것이 위로 올것인지 설정
96
+ :return:
97
+ """
98
+ self.qty = self.qty +1
99
+ if color == "": color = self.color_set[self.qty]
100
+ if line_style == "": line_style = self.line_set[self.qty]
101
+ if marker == "": marker = self.marker_set[self.qty]
102
+
103
+ self.chart.plot(x_l1d, y_l1d)
104
+
105
+ def heat(self):
106
+ import matplotlib.pyplot as plt
107
+ import numpy as np
108
+
109
+ arr = np.random.standard_normal((30, 40))
110
+ # cmap = plt.get_cmap('PiYG')
111
+ # cmap = plt.get_cmap('BuGn')
112
+ # cmap = plt.get_cmap('Greys')
113
+ cmap = plt.get_cmap('bwr')
114
+
115
+ plt.matshow(arr, cmap=cmap)
116
+ plt.colorbar()
117
+ plt.show()
118
+
119
+
120
+ def pie (self, ratio_l1d,y_l1d):
121
+ self.chart.pie(ratio_l1d, labels=y_l1d, autopct='%.1f%%', startangle=260, counterclock=False)
122
+
123
+
124
+ def scatter(self, x, y, size_l1d=None, color_l1d=None, marker=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, edgecolors = None, plotnonfinite=False, *, data=None, **kwargs):
125
+ """
126
+
127
+ :param x:
128
+ :param y:
129
+ :param size_l1d: 원의 크기
130
+ :param color_l1d: 원의 색상을 위한 숫자
131
+ :param marker: 마커의 종류
132
+ :param cmap: 컬러맴을 지정하는 것
133
+ :param norm:
134
+ :param vmin: 색상데이터의 최소, 최대(츠메과 같이 사용)
135
+ :param vmax:
136
+ :param alpha:
137
+ :param linewidths:
138
+ :param edgecolors:
139
+ :param plotnonfinite:
140
+ :param data:
141
+ :param kwargs:
142
+ :return:
143
+ """
144
+
145
+ self.chart.scatter(x, y, s=size_l1d, c=color_l1d)
146
+
147
+
148
+ def bar_one(self, x_l1d, y2_l1d, color="", width="", y1_l1d_bottom="", alpha="", align="", edgecolor=""):
149
+ """
150
+ bar 차트는 기본 넓이는 0.8이다 그리고 정해진 x라인의 틱을 중심으로 0.4 만큼씩 영역을 차지한다
151
+ one_bar(x_l1d, y2_l1d, y1_l1d_bottom, bgcolor, alpha, width, align, edgecolor) bar 의 각 윗부분에 값을 표시하고싶다면, bar 를 만든후 그 각 bar의 속성을 얻어와서 값을 쓰도록 한다 - x 좌파의 숫자 - 높이를 설정, y1이 0이면, 보통의 bar 가되며, 이것에 값이 있으면 거기부터 시작하는 bar가 된다 - bar 가 시작되는 위치 - bgcolor 배경색 - 투명도 0은 없음 bar 의 밑면의 넓이 align, x 좌표숫자의 tic 위치를 기준으로 어디를 기준으로 나타낼것인지 설정하는 것 edgecolor, bar의 테두리 색
152
+ 여러 개일때는 x_l1d를 잘 사용해야 겹체지 않는다, auto 기능을 넣어서 사용하는것도 좋을 듯 bgcolor = auto_unique (자동생성이지만, 겹치지 않게) y1_l1d_bottom 은 몇 개없을땐, [[3,10]]이렇게 사용가능하도록 한다. 아니면 [0,0,10,0,0]처럼 만들던지
153
+ """
154
+ self.qty = self.qty + 1
155
+ if color == "": color = self.color_set[self.qty]
156
+
157
+ self.chart.bar(x_l1d, y2_l1d, color="", width="", y1_l1d_bottom="", alpha="", align="", edgecolor="")
158
+
159
+
160
+ def colorbar(self):
161
+ plt.colorbar()
162
+
163
+ def xtick(self):
164
+ plt.xticks(x="", years="")
165
+
166
+ def show(self):
167
+ self.chart.show()
168
+
169
+ def grid(self):
170
+ #plt.plot(x, x ** 2, color='#e35f62', marker='*', linewidth=2)
171
+ #plt.plot(x, x ** 3, color='springgreen', marker='^', markersize=9)
172
+ plt.grid(True, axis='y', color='red', alpha=0.5, linestyle='--')
173
+
174
+
175
+ def write_text(self):
176
+ # 5. 텍스트 삽입하기
177
+ self.chart.text(1.5, 3.5, 'Max of Data B')
178
+
179
+ def insert_shape(self):
180
+ # 4. 사각형 그리기
181
+ self.chart.add_patch(
182
+ self.chart.patches.Rectangle(
183
+ (1.8, 1.0), # (x, y)
184
+ 0.4, 1.5, # width, height
185
+ edgecolor='deeppink',
186
+ facecolor='lightgray',
187
+ fill=True,
188
+ ))
189
+
190
+ def set_tile_style(self):
191
+ # plt.style.use('ggplot')
192
+ # plt.style.use('classic')
193
+ # plt.style.use('Solarize_Light2')
194
+ # plt.style.use('default')
195
+ plt.style.use('bmh')
196
+
197
+ # plt.scatter(x, y, s=area, c=colors, alpha=0.5, cmap='Spectral')
198
+
199
+
@@ -23,7 +23,6 @@ class xy_color:
23
23
  self.varx : package안에서 공통적으로 사용되는 변수들
24
24
  """
25
25
 
26
- self.rex = xy_re.xy_re()
27
26
  self.varx = xy_common.xy_common().varx
28
27
  self.s_step = 5 # +, -의 각 1개에 hs1에서 s의 값의 변화
29
28
 
@@ -2440,9 +2439,9 @@ class xy_color:
2440
2439
  xcolor용
2441
2440
  입력된 자료의 형태가, xcolor형식인지를 확인하는 것
2442
2441
  """
2443
-
2444
- result1 = self.rex.is_match_all("[한글&영어:2~10][숫자:0~7]", str(input_xcolor))
2445
- result2 = self.rex.is_match_all("[한글&영어:2~10][+-:0~7]", str(input_xcolor))
2442
+ rex = xy_re.xy_re()
2443
+ result1 = rex.is_match_all("[한글&영어:2~10][숫자:0~7]", str(input_xcolor))
2444
+ result2 = rex.is_match_all("[한글&영어:2~10][+-:0~7]", str(input_xcolor))
2446
2445
  if result1 and result2:
2447
2446
  result = result1
2448
2447
  elif result1 and not result2: