Skip to content

Commit cd53e09

Browse files
committed
fix the nuitka-dpg bug where dpg, passes self twice to callbacks, fix github worflowS
1 parent 822a839 commit cd53e09

10 files changed

Lines changed: 88 additions & 42 deletions

File tree

.github/workflows/build-fedora.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build Fedora App
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch: # Allows manual trigger
9+
10+
jobs:
11+
build-fedora:
12+
runs-on: ubuntu-latest
13+
container:
14+
image: fedora:latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Install system dependencies
21+
run: |
22+
dnf update -y
23+
dnf install -y python3 python3-pip python3-devel gcc g++ make
24+
25+
- name: Install Python dependencies
26+
run: |
27+
python3 -m pip install --upgrade pip
28+
pip3 install -r requirements.txt
29+
30+
- name: Build with Nuitka
31+
run: |
32+
# Build with Nuitka
33+
nuitka --standalone --onefile --enable-plugin=no-qt --output-dir=dist src/main.py
34+
35+
# Create tar.gz for easy download
36+
cd dist
37+
tar -czf ../WebScraper-Fedora.tar.gz .
38+
cd ..
39+
40+
- name: Upload build artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: WebScraper-Fedora
44+
path: |
45+
dist/
46+
WebScraper-Fedora.tar.gz

.github/workflows/build-macos.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,7 @@ jobs:
2828
- name: Build with Nuitka
2929
run: |
3030
# Build with Nuitka
31-
nuitka --standalone --onefile main.py
32-
33-
# Organize output to dist/
34-
mkdir -p dist
35-
mv main.dist/* dist/
36-
rm -rf main.dist
31+
nuitka --standalone --onefile --enable-plugin=no-qt --output-dir=dist src/main.py
3732
3833
# Create zip for easy download
3934
cd dist

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Build outputs - ignore everything in dist/
22
dist/
3-
assets/*.csv
4-
assets/*.py
5-
assets/sketches
6-
3+
dev_assets/
74

85
# Python cache
96
__pycache__/

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
### compile
88
```nuitka --standalone --onefile --python-flag=no_site --enable-plugin=no-qt --follow-imports src/main.py```
99

10-
10+
```
11+
nuitka --standalone --onefile --enable-plugin=no-qt --follow-imports --include-data-dir=assets=assets --output-dir=dist --windows-disable-console src/main.py
12+
```
1113

src/gui/components/containers/tab_youtube.py

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,14 @@ def _on_processing_complete(self, result):
300300
self.progress_display.update_progress(final_counts, result.processed_count, result.processed_count)
301301
# Clear the latest URL display when processing completes
302302
self.progress_display.clear_latest_url()
303-
304-
print(f"✅ Processing completed: {result.processed_count} URLs processed")
305303

306304
# Show results table if we have results
307305
if hasattr(result, 'dataframe') and result.dataframe is not None:
308306
self._populate_results_table(result.dataframe)
309307

310308
def _on_processing_error(self, error_message: str):
311309
"""Handle processing error."""
312-
print(f"❌ Processing error: {error_message}")
310+
pass
313311

314312
def _on_processing_state_changed(self, is_processing: bool, is_paused: bool):
315313
"""Handle processing state changes."""
@@ -371,18 +369,11 @@ def _populate_results_table(self, results_df: pd.DataFrame):
371369
"""Populate the results table with processed data."""
372370
self.results_df = results_df
373371

374-
# Debug: Print DataFrame info
375-
print(f"📊 Results DataFrame shape: {results_df.shape}")
376-
print(f"📊 Results DataFrame columns: {list(results_df.columns)}")
377-
print(f"📊 First few rows:\n{results_df.head()}")
378-
379372
# Get column mapping info
380373
if self.column_selector:
381374
columns_data = self.column_selector.get_all_selected_columns()
382375
self.video_url_column = columns_data['post_column']
383376
self.preserved_columns = columns_data['preserve_columns']
384-
print(f"📊 Video URL column: {self.video_url_column}")
385-
print(f"📊 Preserved columns: {self.preserved_columns}")
386377

387378
# Clear existing table content
388379
if dpg.does_item_exist(self.results_table_id):
@@ -396,13 +387,8 @@ def _populate_results_table(self, results_df: pd.DataFrame):
396387
# Define column order: Video URL, Status, then preserved columns
397388
table_columns = [self.video_url_column, 'status'] + self.preserved_columns
398389

399-
# Debug: Check which columns actually exist
400-
available_columns = [col for col in table_columns if col in results_df.columns]
401-
missing_columns = [col for col in table_columns if col not in results_df.columns]
402-
print(f"📊 Available columns: {available_columns}")
403-
print(f"📊 Missing columns: {missing_columns}")
404-
405390
# Use only available columns
391+
available_columns = [col for col in table_columns if col in results_df.columns]
406392
table_columns = available_columns
407393

408394
# Add table columns
@@ -456,7 +442,6 @@ def _populate_results_table(self, results_df: pd.DataFrame):
456442
def _on_export_file_selected(self, file_path: str):
457443
"""Handle export file selection using our FilePicker component."""
458444
if self.results_df is None:
459-
print("❌ No results to export")
460445
return
461446

462447
try:
@@ -473,10 +458,9 @@ def _on_export_file_selected(self, file_path: str):
473458
# Export only the selected columns
474459
export_df = self.results_df[available_export_columns]
475460
export_df.to_csv(file_path, index=False)
476-
print(f"✅ Results exported to: {file_path}")
477461

478462
except Exception as e:
479-
print(f"❌ Export error: {e}")
463+
pass
480464

481465
def _clear_results(self):
482466
"""Clear results table and data before starting new processing."""

src/gui/components/panels/panel_column_selector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def populate_columns(self, csv_columns: List[str]):
9191
if i < len(csv_columns) - 1:
9292
dpg.add_spacer(height=2)
9393

94-
def _on_post_column_selected(self, sender, value):
94+
def _on_post_column_selected(self, sender, value, *args, **kwargs):
9595
"""Handle post column selection."""
9696
if self.callback:
9797
try:

src/gui/components/widgets/button_group_processing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ def set_processing_state(self, processing: bool, paused: bool = False):
108108
if dpg.does_item_exist(self.cancel_button_id):
109109
dpg.configure_item(self.cancel_button_id, enabled=False)
110110

111-
def _on_start_clicked(self):
111+
def _on_start_clicked(self, *args, **kwargs):
112112
"""Handle start button click."""
113113
if self.on_start_callback:
114114
self.on_start_callback()
115115

116-
def _on_pause_clicked(self):
116+
def _on_pause_clicked(self, *args, **kwargs):
117117
"""Handle pause/resume button click."""
118118
if self.state == ControlState.PROCESSING:
119119
if self.on_pause_callback:
@@ -122,7 +122,7 @@ def _on_pause_clicked(self):
122122
if self.on_resume_callback:
123123
self.on_resume_callback()
124124

125-
def _on_cancel_clicked(self):
125+
def _on_cancel_clicked(self, *args, **kwargs):
126126
"""Handle cancel button click."""
127127
if self.on_cancel_callback:
128128
self.on_cancel_callback()

src/gui/components/widgets/dropdown_widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def setup_ui(self):
3939
callback=self._on_selection_changed
4040
)
4141

42-
def _on_selection_changed(self, sender, value):
42+
def _on_selection_changed(self, sender, value, *args, **kwargs):
4343
"""Handle dropdown selection changes."""
4444
self.selected_value = value
4545
if self.callback:

src/gui/components/widgets/file_input_picker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ def setup_ui(self, input_width: int = 400, placeholder_text: str = "No file sele
5555
dpg.add_file_extension(".csv", color=(255, 255, 0, 255))
5656
dpg.add_file_extension(".*", color=(255, 255, 255, 255))
5757

58-
def _show_file_dialog(self):
58+
def _show_file_dialog(self, *args, **kwargs):
5959
"""Show the file selection dialog."""
6060
dpg.show_item(self.file_dialog_id)
6161

62-
def _file_selected(self, sender, app_data):
62+
def _file_selected(self, sender, app_data, *args, **kwargs):
6363
"""Handle file selection from dialog."""
6464
file_path = app_data['file_path_name']
6565
self.selected_file = file_path

src/gui/main_window.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import dearpygui.dearpygui as dpg
22
import pandas as pd
33
from typing import Optional
4-
54
import sys
65
import os
76
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@@ -13,6 +12,25 @@
1312
from gui.theme import AppTheme
1413

1514

15+
def get_resource_path(relative_path: str) -> str:
16+
"""Get absolute path to resource, works for dev and for Nuitka."""
17+
if getattr(sys, 'frozen', False) or '/tmp/onefile_' in __file__:
18+
# Running in Nuitka onefile binary - assets are in temp directory
19+
if hasattr(sys, '_MEIPASS'):
20+
# PyInstaller style
21+
base_path = sys._MEIPASS
22+
else:
23+
# Nuitka onefile - get the temp extraction directory
24+
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
25+
resource_path = os.path.join(base_path, relative_path)
26+
else:
27+
# Running in development
28+
base_path = os.path.dirname(__file__)
29+
resource_path = os.path.join(base_path, "..", "..", relative_path)
30+
31+
return os.path.abspath(resource_path)
32+
33+
1634
class MainWindow:
1735
"""Primary GUI controller using Dear PyGui."""
1836

@@ -44,11 +62,15 @@ def setup_ui(self):
4462

4563
# Load larger font for 4K display
4664
with dpg.font_registry():
47-
font_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
48-
"assets", "fonts", "NotoSans-Medium.ttf")
49-
large_font = dpg.add_font(font_path, 22) # 20px for 4K, adjust as needed
65+
font_path = get_resource_path("assets/fonts/NotoSans-Medium.ttf")
66+
67+
if os.path.exists(font_path):
68+
large_font = dpg.add_font(font_path, 22)
69+
else:
70+
large_font = None
5071

51-
dpg.bind_font(large_font)
72+
if large_font:
73+
dpg.bind_font(large_font)
5274

5375
# Platform Tabs
5476
self.platform_tabs = PlatformTabs(

0 commit comments

Comments
 (0)