pogucam 0.1.3__py3-none-any.whl → 0.1.4__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.
@@ -63,7 +63,7 @@ import base64
63
63
  import getpass
64
64
  import time
65
65
 
66
- from flashcam.text_write import iprint, fonts_available, get_f_height, get_f_width, get_def_font, set_def_font
66
+ from pogucam.text_write import iprint, fonts_available, get_f_height, get_f_width, get_def_font, set_def_font
67
67
  from console import fg, bg, fx
68
68
 
69
69
  from astropy.io import fits
@@ -87,8 +87,8 @@ UPDATE_INTERVAL = 1
87
87
 
88
88
  # ---------- files:
89
89
  FILE_USERPASS = "~/.config/flashcam/.flashcam_upw" # will extend
90
- FILE_REDCROSS0 = "~/.config/flashcam/crossred" # will extend
91
- FILE_REDCROSS = "~/.config/flashcam/crossred" # will extend
90
+ FILE_REDCROSS0 = "~/.config/pogucam/crossred" # will extend
91
+ FILE_REDCROSS = "~/.config/pogucam/crossred" # will extend
92
92
 
93
93
  # ================================================================================
94
94
  # RA "00 12 45.2"
@@ -0,0 +1,8 @@
1
+ uv add pillow
2
+ uv add numpy
3
+ uv add opencv-python
4
+ uv add requests
5
+ uv add console
6
+ uv add pyqt6
7
+ uv add astropy
8
+ uv add click
pogucam/text_write.py ADDED
@@ -0,0 +1,535 @@
1
+
2
+ #!/usr/bin/env python3
3
+
4
+ #from fire import Fire
5
+ #from flashcam.version import __version__
6
+ import os
7
+ import cv2
8
+ from PIL import ImageFont, ImageDraw, Image
9
+ import numpy as np
10
+
11
+
12
+ # Code: ttfname, FSize(pt), KERN, FHieght, FWidth
13
+ #Fheight=>shiftUP txt by it
14
+ # default 10,0,10,5
15
+ fonts_available = {
16
+ "s8":["small_pixel.ttf",8,0,7,5],
17
+ "s6":["small_pixel.ttf",6,0,6,5],
18
+ "pr":["prstartk.ttf",6,-1,6,5],
19
+ "pr4":["prstartk.ttf",10,-1,10,9],
20
+ "fj":["PixelFJVerdana12pt.ttf",4,0,6,5],
21
+ "fj6":["PixelFJVerdana12pt.ttf",6,0,12,6],
22
+ "re":["retganon.ttf",12,0,9,4],
23
+ "p8":["pixelFJ8pt1__.TTF",8,0,6,5] ,
24
+ "p7":["pixelFJ8pt1__.TTF",7,0,6,5] ,
25
+ "ty":["TypographerFraktur-Medium.ttf",14,0,16,7],
26
+ "v1":["visitor1.ttf",10,0,7,5],
27
+ "v14":["visitor1.ttf",14,0,10,7 ],
28
+ "v18":["visitor1.ttf",18,0,13,9 ],
29
+ "v2":["visitor2.ttf",12,0,6,5],
30
+ "co":["coders_crux.ttf",16,-1,7,5],
31
+ # "ji":["JikiTourai.ttf",10,0,10,6],
32
+ # "ca":["Caracas.ttf",10,0,10,7],
33
+ # "sa":["SAIBA-45.ttf",12,0,10,7],
34
+ # "ni":["NimbusMono-Regular.otf",12,0,9,7],
35
+ # "nib":["NimbusMono-Bold.otf",12,0,9,7],
36
+ # "li":["LiberationMono-Regular.ttf",12,0,10,7],
37
+ # "cu":["COURIERO.TTF",10,0,8,7],
38
+ "di":["digital-7.mono.ttf",10,0,8,5],
39
+ "di2":["digital-7.mono.ttf",20,0,16,10],
40
+ # "di":["digital-7.mono.ttf",9,0,7,6],
41
+ "di99":["digital-7.mono.ttf",120,0,170,15],
42
+ "di90":["digital-7.mono.ttf",110,0,155,14],
43
+ "vt":["VT323-Regular.ttf",12,-1,6,5],
44
+ "vt4":["VT323-Regular.ttf",14,-1,13,5],
45
+ "utfu":[ "Uni_Sans_Thin.otf", 24, 0, 24, 8 ], # uppercase thin
46
+ "utfo":[ "OpenSans-Regular.ttf", 24, 0, 30, 12 ],
47
+ "utfg":[ "good_times_rg.otf", 24, 0, 24, 8 ], # uppercase - broad
48
+ # "utfp":[ "pricedown_bl.otf", 24, 0, 24, 8 ], # uppercase BoldSignature
49
+ "utfh":[ "hemi_head_bd_it.otf", 24, -2, 24, 14 ]
50
+ }
51
+
52
+ LAST_FONT = None
53
+
54
+ MSG_FONT = "v14"
55
+ WIDGET_DEFAULT_GREEN = (0, 255, 0)
56
+ WIDGET_DEFAULT_ALERTRED = (50, 50, 255)
57
+ #
58
+ WIDGET_DEFAULT_DGREEN = (0, 120, 0)
59
+ WIDGET_DEFAULT_YELLOW = (0, 255, 255) #(100, 255, 185)
60
+ #WIDGET_DEFAULT_COLOR = (255, 250, 255) # BGR
61
+ #WIDGET_DEFAULT_COLOR = (255, 0, 0) # blu
62
+ #WIDGET_DEFAULT_COLOR = (0, 255, 255) # yell
63
+ #WIDGET_DEFAULT_COLOR = (100, 205, 105) #
64
+ WIDGET_DEFAULT_COLOR = WIDGET_DEFAULT_YELLOW
65
+ WIDGET_DEFAULT_COLOR_DARK = WIDGET_DEFAULT_DGREEN
66
+ WIDGET_DEFAULT_COLOR_BLACK = (0, 0, 0)
67
+ WIDGET_DEFAULT_COLOR_WHITE = (255, 255, 255)
68
+ # for auto color
69
+ WIDGET_COLOR_THRESHOLD = 210
70
+ WIDGET_COLOR_THRESHOLD_LOW = 140
71
+
72
+ def set_def_font( font ):
73
+ global LAST_FONT
74
+ if font is None: LAST_FONT = "p8"
75
+ if font in fonts_available.keys():
76
+ LAST_FONT = font
77
+ else:
78
+ LAST_FONT = "p8"
79
+
80
+
81
+ def get_def_font():
82
+ global LAST_FONT
83
+ return LAST_FONT
84
+
85
+
86
+ def get_f_width(font = None):
87
+ global LAST_FONT
88
+ mfont = font
89
+ if mfont is None: mfont = LAST_FONT
90
+ if mfont is None: return 5
91
+ if mfont in fonts_available.keys():
92
+ #LAST_FONT = mfont
93
+ return fonts_available[mfont][4]
94
+ else:
95
+ return 5
96
+
97
+ def get_f_height(font = None):
98
+ global LAST_FONT
99
+ mfont = font
100
+ if mfont is None: mfont = LAST_FONT
101
+ if mfont is None: return 25
102
+ if mfont in fonts_available.keys():
103
+ #LAST_FONT = mfont
104
+ return fonts_available[mfont][3]
105
+ else:
106
+ return 25
107
+
108
+ #def iprint( frame, drtext, font, position , color_bgra=(100,0,0,0) ):
109
+ # mess - it seems RGB is needed
110
+ #
111
+ def iprint( frame, drtext, font, position , color_rgb=(0,255,0) ):
112
+ global LAST_FONT
113
+
114
+ if drtext is None: return
115
+ if type(drtext) is not str:
116
+ drtext = str(drtext)
117
+ mfont = font
118
+ if mfont is None: mfont = LAST_FONT
119
+ if mfont is None: return frame
120
+ if mfont in fonts_available.keys():
121
+ #print("D.... FONT ACCEPTED:", mfont )
122
+ #print("D.... FONT ACCEPTED:", fonts_available[mfont][0] )
123
+ #LAST_FONT = mfont
124
+ # prepare font
125
+ fname = fonts_available[mfont][0]
126
+ fsize = fonts_available[mfont][1]
127
+ fkern = fonts_available[mfont][2]
128
+ fheig = fonts_available[mfont][3]
129
+ fontpath = os.path.expanduser(f"~/.config/flashcam/{fname}")
130
+ font = ImageFont.truetype(fontpath, fsize)
131
+ #### draw
132
+ #### img_pil = Image.fromarray(frame.astype('uint8'), 'RGB') # sometimes crashes
133
+ # img_pil = Image.fromarray(frame) ##### BUGBUG !!!!!!!!!!!!!!!!
134
+
135
+ # Tying to repair:
136
+ # Ensure the frame has correct data type
137
+ if frame.dtype != np.uint8:
138
+ frame = (255 * frame).astype(np.uint8) if frame.max() <= 1 else frame.astype(np.uint8)
139
+ img_pil = Image.fromarray(frame) # Correct data type
140
+ # emd of repair
141
+
142
+ draw = ImageDraw.Draw(img_pil )
143
+
144
+ letter_spacing = fkern
145
+ x,y=position
146
+ # Draw each character with custom spacing
147
+ for chara in drtext:
148
+ #print(f"D... #fill@draw.text: {frame.shape} {color_rgb} {type(color_rgb)} CHAR={chara}/{ord(chara)}/; {(x, y-fheig)}")
149
+ #color_rgb = (255,255,255)
150
+
151
+ try:
152
+ draw.text((x, y-fheig), str(chara), fill=color_rgb, font=font, align="left")
153
+ except:
154
+ draw.text((x, y-fheig), chara, font=font, align="left")
155
+
156
+ # THIS WORKS ONLY WITH pillow==9.0.1 ####################
157
+ #char_width, _ = draw.textsize(chara, font=font)
158
+ #char_width, _ = draw.textsize(chara, font=font)
159
+ #x += char_width + letter_spacing
160
+ # replacing with
161
+ bbox = draw.textbbox((0, 0), chara, font=font)
162
+ char_width = bbox[2] - bbox[0]
163
+ x += char_width + letter_spacing
164
+
165
+ frame = np.array(img_pil)
166
+ return frame
167
+
168
+
169
+
170
+ def get_color_based_on_brightness(frame, left_up_point , right_down_point):
171
+ (x1, y1) = left_up_point
172
+ (x2, y2) = right_down_point
173
+ x1 = max(0, x1)
174
+ x2 = min( frame.shape[1], x2)
175
+ y1 = max(0, y1)
176
+ y2 = min(frame.shape[0], y2)
177
+ # Extract the region of interest (ROI)
178
+ roi = frame[y1:y2, x1:x2]
179
+
180
+ # Convert the ROI to grayscale
181
+ gray_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY)
182
+ # Calculate the average brightness - no, maximum!
183
+ avg_brightness = int(np.mean(gray_roi))
184
+ max_brightness = int(np.max(gray_roi))
185
+
186
+ # if average_brightness < WIDGET_COLOR_THRESHOLD:
187
+ if max_brightness < WIDGET_COLOR_THRESHOLD:
188
+ return tuple( WIDGET_DEFAULT_COLOR )
189
+ else:
190
+ # it is bright
191
+ min_brightness = int(np.min(gray_roi))
192
+ avg_brightness = int(np.mean(gray_roi))
193
+ #print(f"------{min_brightness} {avg_brightness} {max_brightness}----")
194
+ if (min_brightness > 40) and (avg_brightness < 150):
195
+ return tuple(WIDGET_DEFAULT_COLOR_BLACK)
196
+ if (min_brightness > 40) and (avg_brightness >= 150):
197
+ return tuple(WIDGET_DEFAULT_COLOR_DARK)
198
+ if (min_brightness <= 40) and (avg_brightness >= 100):
199
+ return tuple(WIDGET_DEFAULT_COLOR_DARK) #?
200
+ if (min_brightness <= 40) and (avg_brightness < 100):
201
+ return tuple(WIDGET_DEFAULT_COLOR_WHITE)
202
+ return tuple(WIDGET_DEFAULT_COLOR_WHITE)
203
+
204
+ # # Convert the ROI to HSV color space
205
+ # hsv_roi = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV)
206
+ # # Extract the Hue channel
207
+ # hue_channel = hsv_roi[:, :, 0]
208
+ # # Calculate the average hue
209
+ # average_hue = np.mean(hue_channel)
210
+ # # Calculate the contrasting hue
211
+ # contrasting_hue = (average_hue + 20) % 180 # Adding 90 for a contrasting color in OpenCV's 0-180 range
212
+ # #contrasting_hue = average_hue
213
+ # print( int(average_hue), " ",int(contrasting_hue) , end=" ")
214
+ # # Define the allowed hue ranges (in OpenCV's 0-180 hue range)
215
+ # allowed_ranges = [(20, 40), (40, 80), (140, 160), (80, 100)] # Yellow, green, pink, cyan
216
+ # allowed_ranges = [(0, 180)] # Yellow, green, pink, cyan
217
+ # allowed_ranges = [(4, 25)] # Yellow, green, pink, cyan
218
+ # allowed_ranges = [(6, 255)] # Yellow, green, pink, cyan
219
+
220
+ # # Define the ranges to avoid (in OpenCV's 0-180 hue range)
221
+ # avoid_ranges = [(0, 15), (165, 180), (105, 135)] # Deep red, deep blue, violet
222
+
223
+ # # Adjust the contrasting hue to fall within the allowed ranges
224
+ # for low, high in allowed_ranges:
225
+ # if low <= contrasting_hue <= high:
226
+ # break
227
+ # else:
228
+ # # If the initial contrasting hue is not in any allowed range, pick the closest allowed range
229
+ # closest_range = min(allowed_ranges, key=lambda r: min(abs(contrasting_hue - r[0]), abs(contrasting_hue - r[1])))
230
+ # contrasting_hue = (closest_range[0] + closest_range[1]) // 2
231
+
232
+ # # # Adjust the contrasting hue to avoid the specified ranges
233
+ # # for low, high in avoid_ranges:
234
+ # # if low <= contrasting_hue <= high:
235
+ # # contrasting_hue = (high + 15) % 180
236
+ # # break
237
+
238
+ # # Create an HSV image with the contrasting hue
239
+ # hsv_contrasting = np.zeros((1, 1, 3), dtype=np.uint8)
240
+ # hsv_contrasting[0, 0, 0] = contrasting_hue
241
+ # hsv_contrasting[0, 0, 1] = 245 # Full saturation
242
+ # hsv_contrasting[0, 0, 2] = 255 # Full value (brightness)
243
+
244
+ # floor = 70 # base green
245
+ # tresh = 150
246
+ # if average_brightness>tresh:
247
+ # nc = floor
248
+ # else:
249
+ # nc = (tresh-average_brightness)/(tresh)
250
+ # nc = int((255-floor)*nc*nc)+floor
251
+ # #nc = 255 - average_brightness
252
+ # if nc>255:nc=255
253
+ # if nc<60:nc=60
254
+ # hsv_contrasting[0, 0, 2] = nc # Full value (brightness)
255
+
256
+ # # Convert the HSV image to BGR
257
+ # bgr_contrasting = cv2.cvtColor(hsv_contrasting, cv2.COLOR_HSV2BGR)
258
+ # # Get the BGR values
259
+ # bgr_values = bgr_contrasting[0, 0]
260
+
261
+ # # # # Find the maximum component value
262
+ # #max_component = np.max(bgr_values) # Calculate the scaling factor to make the maximum component 255
263
+ # #scaling_factor = 255 / max_component # Scale the color components
264
+ # #bgr_values = np.clip(bgr_values * scaling_factor, 0, 255).astype(np.uint8)
265
+
266
+
267
+ # #print(f" {bgr_values} avgb= {average_brightness} x trsh={tresh} /FLO{floor} NC={nc} ")
268
+ # return tuple(bgr_values)
269
+
270
+
271
+
272
+ def dial(frame, position, radius=30, thickness=10, color=WIDGET_DEFAULT_COLOR, percentage=100, value = 12.3, title=""):
273
+ """
274
+ AI generated: too many iterations
275
+ use with text:
276
+ FO="v14"
277
+ frame = iprint( frame,
278
+ str(round(100*overtextalpha/255)),
279
+ FO,
280
+ position = (post[0]-2*get_f_width(FO)//2,
281
+ post[1] +get_f_height(FO)//2 ),
282
+ color_rgb= (0,255, 0, 255-int(overtextalpha))
283
+ )
284
+
285
+ """
286
+ MY_CIRC_COLOR = WIDGET_DEFAULT_GREEN
287
+ #if percentage <= 0: MY_CIRC_COLOR = (100, 100, 255) # BGR
288
+ if percentage >= 100:
289
+ MY_CIRC_COLOR = WIDGET_DEFAULT_ALERTRED #(50, 50, 255) # BGR
290
+ # Calculate the bounding box of the circle
291
+ left_up_point = (position[0] - radius, position[1] - radius)
292
+ right_down_point = (position[0] + radius, position[1] + radius)
293
+ #ncolor = get_color_based_on_brightness( frame, left_up_point , right_down_point)
294
+ ncolor = color
295
+
296
+ # Convert the image to a PIL Image
297
+ pil_img = Image.fromarray(frame)
298
+ draw = ImageDraw.Draw(pil_img)
299
+
300
+
301
+
302
+
303
+
304
+ # Calculate the start angle based on the percentage for clockwise drawing
305
+ end_angle = 270 # Ending at the top (north)
306
+ start_angle = end_angle - (360 * (percentage / 100.0))
307
+
308
+ # Draw the partial circle (arc)
309
+ draw.arc([left_up_point, right_down_point], start=start_angle, end=end_angle, fill=MY_CIRC_COLOR , width=thickness)
310
+
311
+ # Draw a thin full circle as a guide
312
+ guide_thickness = 1 # Set the thickness of the guide circle
313
+ draw.ellipse([left_up_point, right_down_point], outline=MY_CIRC_COLOR , width=guide_thickness)
314
+
315
+ # Convert back to OpenCV image
316
+
317
+
318
+ frame = np.array(pil_img)
319
+ FO="v14"
320
+ FO=MSG_FONT
321
+ frame = iprint( frame,
322
+ str( value),
323
+ FO,
324
+ position = (position[0]-2*get_f_width(FO)//2,
325
+ position[1] +get_f_height(FO)//2 ),
326
+ color_rgb= ncolor
327
+ )
328
+ frame = iprint( frame,
329
+ str( title),
330
+ FO,
331
+ position = (position[0]-len(title)*get_f_width(FO)//2,
332
+ position[1] + radius + get_f_height(FO) ),
333
+ color_rgb= ncolor
334
+ )
335
+ return frame
336
+
337
+
338
+ def tacho(frame, position, radius=30, thickness=10, color=WIDGET_DEFAULT_COLOR, percentage=100, value = 12.3, title=""):
339
+ """
340
+
341
+ """
342
+
343
+ # Calculate the bounding box of the circle
344
+ left_up_point = (position[0] - radius, position[1] - radius)
345
+ right_down_point = (position[0] + radius, position[1] + radius)
346
+ #ncolor = get_color_based_on_brightness( frame, left_up_point , right_down_point)
347
+ ncolor = color
348
+
349
+ # Convert the image to a PIL Image
350
+ pil_img = Image.fromarray(frame)
351
+ draw = ImageDraw.Draw(pil_img)
352
+
353
+
354
+
355
+ # Calculate the start angle based on the percentage for clockwise drawing
356
+ end_angle = 180 # Ending at the top (north)
357
+ start_angle = end_angle - (180 * (percentage / 100.0))
358
+
359
+ start_angle = 180 # 90 is bottom 180 is left
360
+ end_angle = start_angle + (180 * (percentage / 100.0)) # Ending at the top (north)
361
+
362
+ # Draw the partial circle (arc)
363
+ draw.arc([left_up_point, right_down_point], start=start_angle, end=end_angle, fill=WIDGET_DEFAULT_GREEN , width=thickness)
364
+
365
+ # Draw a thin full circle as a guide
366
+ guide_thickness = 1 # Set the thickness of the guide circle
367
+ draw.arc([left_up_point, right_down_point], start=start_angle, end=start_angle + 180, fill=WIDGET_DEFAULT_GREEN , width=1)
368
+ #draw.ellipse([left_up_point, right_down_point], outline=WIDGET_DEFAULT_GREEN , width=guide_thickness)
369
+
370
+ # Convert back to OpenCV image
371
+
372
+
373
+ frame = np.array(pil_img)
374
+ FO="v14"
375
+ FO=MSG_FONT
376
+ frame = iprint( frame,
377
+ str( value),
378
+ FO,
379
+ position = (position[0]-2*get_f_width(FO)//2,
380
+ position[1] +get_f_height(FO)//2 ),
381
+ color_rgb= ncolor
382
+ )
383
+ frame = iprint( frame,
384
+ str( title),
385
+ FO,
386
+ position = (position[0]-len(title)*get_f_width(FO)//2,
387
+ right_down_point[1] - get_f_height(FO)),
388
+ color_rgb= ncolor
389
+ ) # tacho righd==lowlow
390
+ return frame
391
+
392
+
393
+ def signal_strength(frame, position, radius=30, color=WIDGET_DEFAULT_COLOR, percentage=100, value = 0.0, title=""):
394
+ """
395
+ by AI:
396
+ """
397
+ ratio = 2.33
398
+ # size = 50 # with this I started
399
+ size = int(radius * 5 / 3) # To keep compatibility with dial+tacho
400
+ #print( type(position), position[0], position[1] )
401
+ # Calculate the vertices of the triangle
402
+ bottom_left = (position[0] - int(size / 2), position[1] + int(size / 2) )
403
+
404
+ bottom_right = (position[0] + int(size / 2), position[1] + int(size / 2) )
405
+
406
+ top_right = (position[0] + int(size / 2), position[1] - int(size / ratio) )
407
+
408
+ # Draw the hollow green triangle
409
+ cv2.line(frame, bottom_left, bottom_right, WIDGET_DEFAULT_GREEN, 1)
410
+ cv2.line(frame, bottom_right, top_right, WIDGET_DEFAULT_GREEN, 1)
411
+
412
+ # print( bottom_left, " ___ ", bottom_right )
413
+ # print( bottom_right, " /// ", top_right )
414
+ #cv2.line(image, top_right, bottom_left, (0, 255, 0), 1)
415
+
416
+ # Calculate the fill level based on the percentage
417
+ fill_level = int( size * (percentage / 100.0))
418
+
419
+ # Draw the filled part of the triangle
420
+ if fill_level > 0:
421
+ pts = np.array([[
422
+ bottom_left,
423
+ (bottom_left[0] + fill_level, bottom_left[1]),
424
+ (bottom_left[0] + fill_level, bottom_left[1] - int( fill_level /ratio ) )
425
+ ] ],
426
+ np.int32)
427
+
428
+ cv2.fillPoly(frame, [pts], WIDGET_DEFAULT_GREEN )
429
+
430
+ FO="v14"
431
+ FO=MSG_FONT
432
+
433
+ frame = iprint( frame,
434
+ str( value),
435
+ #str( round(percentage)),
436
+ FO,
437
+ position = (position[0] -get_f_width(FO)//2,
438
+ position[1] -get_f_height(FO) ),
439
+ color_rgb= ( color[0],color[1], color[2] )
440
+ )
441
+ frame = iprint( frame,
442
+ str( title),
443
+ FO,
444
+ position = (position[0]-len(title)*get_f_width(FO)//2,
445
+ position[1] + size // 2 + get_f_height(FO) ),
446
+ color_rgb= ( color[0],color[1], color[2] )
447
+ ) # signal; size//2==ontheline; size==lowlow;
448
+ return frame
449
+
450
+
451
+ def text_box(image, position, color=WIDGET_DEFAULT_COLOR, split_height=20, title="Title", values = "rate 123.2 uSv\n tot 220 mSv"):
452
+ # Calculate the corners of the box
453
+ FO="v14"
454
+ FO=MSG_FONT
455
+
456
+ maxw=0
457
+ shift2left = 0
458
+ xmargin = 30 # keep min
459
+
460
+ # ';' is already used for a standard min;max;timeout
461
+ # '# for lines SPLIT
462
+ mylines = values.split("\n")
463
+ if len(mylines) == 1:
464
+ mylines = mylines[0].split("#")
465
+
466
+ #print("D... box write:", mylines)
467
+ for i in mylines:
468
+ a = get_f_width(FO)*(len(str(i))+2)
469
+ if a>maxw: maxw=a
470
+ a = get_f_width(FO)*(len(str(title))+2)
471
+ if a>maxw: maxw=a
472
+ # I hava maxw == text wid
473
+
474
+
475
+ startx = position[0] - maxw // 2
476
+
477
+ if maxw + startx > image.shape[1]-xmargin:
478
+ delta = maxw + startx - image.shape[1] + xmargin
479
+ startx = startx - delta
480
+
481
+ #xbox_size[1] = maxw
482
+ if len(mylines)>0:
483
+ xbox_size = [ maxw , get_f_height(FO)* (len(mylines)+3) ]
484
+ else:
485
+ xbox_size = [ maxw , get_f_height(FO)* (len(mylines)+1) ]
486
+
487
+ top_left = ( startx - shift2left, position[1] )
488
+ bottom_right = (startx + xbox_size[0] - shift2left, position[1] + xbox_size[1] )
489
+ #bottom_left = (position[0], position[1] + xbox_size[1])
490
+ #top_right = (position[0] + xbox_size[0], position[1])
491
+ # Draw the rectangle for the text box in green
492
+
493
+
494
+ cv2.rectangle(image, top_left, bottom_right, WIDGET_DEFAULT_GREEN , 1)
495
+
496
+ # Draw the horizontal split line in green
497
+ split_line_start = (startx -shift2left, position[1] + split_height)
498
+ split_line_end = (startx + xbox_size[0]-shift2left, position[1] + split_height)
499
+
500
+ if len(mylines)>0:
501
+ cv2.line(image, split_line_start, split_line_end, WIDGET_DEFAULT_GREEN , 1)
502
+
503
+ FO = "v14"
504
+ image = iprint( image,
505
+ str( title ),
506
+ FO,
507
+ position = (startx +get_f_width(FO)-shift2left,
508
+ position[1] + 1.2*get_f_height(FO) ),
509
+ color_rgb= ( color[0],color[1], color[2] )
510
+ )
511
+
512
+ if len(title)>0:
513
+ nsk=0
514
+ else:
515
+ nsk=-2
516
+
517
+ if len(mylines) > 0:
518
+ for i in mylines:
519
+ image = iprint( image,
520
+ str( i),
521
+ FO,
522
+ position = (startx +get_f_width(FO)-shift2left,
523
+ position[1] +(nsk+3)* get_f_height(FO) + int(split_height / 2) - 2),
524
+ color_rgb= ( color[0],color[1], color[2] )
525
+ )
526
+ nsk+=1
527
+
528
+
529
+ return image
530
+
531
+ def main():
532
+ print()
533
+
534
+ if __name__=="__main__":
535
+ main()
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: pogucam
3
+ Version: 0.1.4
4
+ Summary: Add your description here
5
+ Author-email: jaromrax <jaromrax@gmail.com>
6
+ Requires-Python: >=3.12
7
+ Requires-Dist: astropy>=7.1.0
8
+ Requires-Dist: click>=8.2.1
9
+ Requires-Dist: console>=0.9911
10
+ Requires-Dist: numpy>=2.3.0
11
+ Requires-Dist: opencv-python>=4.11.0.86
12
+ Requires-Dist: pillow>=11.2.1
13
+ Requires-Dist: pyqt6>=6.9.1
14
+ Requires-Dist: requests>=2.32.4
15
+ Description-Content-Type: text/markdown
16
+
17
+ # POor GUy CAMera tool
18
+
@@ -0,0 +1,8 @@
1
+ pogucam/__init__.py,sha256=Iij7VvXCrFPMtTia41mQ7LxFLaulf_fD5cb-AyjpUo0,53
2
+ pogucam/explore_u24_uni.py,sha256=Ff7f3JkeWDRdSI6o52ZBM4JoWxIMnGzxH5NV_Bn0zBI,115676
3
+ pogucam/installation.md,sha256=8qspiLlYjEBx5CedRfBU7Mm0A2pz0lfAnaupZyBm5Eo,128
4
+ pogucam/text_write.py,sha256=hyRyA1M5z-pda963T-k0i8fvvAlv1p3YBTZtYNdOeoE,19304
5
+ pogucam-0.1.4.dist-info/METADATA,sha256=cpcxAlTeU57rHTtTzc_tlsde57hRgK1Hf6v7nDfsBJo,466
6
+ pogucam-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ pogucam-0.1.4.dist-info/entry_points.txt,sha256=2HKUwWLXuAMIvwAMTSJ2BUasPkGK1SnDgIW7LJ8z-pA,55
8
+ pogucam-0.1.4.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pogucam
3
- Version: 0.1.3
4
- Summary: Add your description here
5
- Author-email: jaromrax <jaromrax@gmail.com>
6
- Requires-Python: >=3.12
7
- Description-Content-Type: text/markdown
8
-
9
- # POor GUy CAMera tool
10
-
@@ -1,6 +0,0 @@
1
- pogucam/__init__.py,sha256=Iij7VvXCrFPMtTia41mQ7LxFLaulf_fD5cb-AyjpUo0,53
2
- pogucam/explore_u24_uni.py,sha256=2lpKoMkILYY6AU7Fiew9aJ_bB6w-rFyeRWdWyfkJYlk,115679
3
- pogucam-0.1.3.dist-info/METADATA,sha256=ssJoh8Z_d8pJhdHUoG58JkHeB3dMOK4i2a1Dvk3XSQ8,219
4
- pogucam-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
5
- pogucam-0.1.3.dist-info/entry_points.txt,sha256=2HKUwWLXuAMIvwAMTSJ2BUasPkGK1SnDgIW7LJ8z-pA,55
6
- pogucam-0.1.3.dist-info/RECORD,,