11from PySide6 .QtWidgets import (QDialog , QVBoxLayout , QHBoxLayout , QLabel ,
22 QComboBox , QPushButton , QRadioButton , QButtonGroup ,
3- QLineEdit , QGroupBox , QFileDialog , QProgressDialog , QMessageBox )
4- from PySide6 .QtCore import Qt
3+ QLineEdit , QGroupBox , QFileDialog , QMessageBox )
4+ from PySide6 .QtCore import Qt , QCoreApplication
55from binaryninja import log_info , log_error , log_warn
66from .model_load_thread import ModelLoadThread
77from .upload_binary_thread import UploadBinaryThread
8+ from revengai_bn .utils import create_progress_dialog
9+ import time
810
911class UploadDialog (QDialog ):
1012 def __init__ (self , config , uploader , bv ):
@@ -15,10 +17,8 @@ def __init__(self, config, uploader, bv):
1517 self .model_thread = None
1618 self .upload_thread = None
1719 self .progress = None
18- self .load_models ()
1920 self .init_ui ()
2021
21-
2222 def init_ui (self ):
2323 self .setWindowTitle ("RevEng.AI: Process Binary" )
2424 self .setMinimumWidth (500 )
@@ -81,37 +81,25 @@ def init_ui(self):
8181 layout .addLayout (button_layout )
8282
8383 self .setLayout (layout )
84+
85+ # Show and process the dialog first
86+ self .show ()
87+ QCoreApplication .processEvents ()
88+
89+ # Now start loading models
90+ self .load_models ()
8491
8592 def load_models (self ):
8693 """Start loading models in background"""
87- # Create and show progress dialog
88- self .progress = QProgressDialog ("Loading available models..." , None , 0 , 0 , self )
89- self .progress .setWindowTitle ("RevEng.AI" )
90- self .progress .setWindowModality (Qt .WindowModal )
91- self .progress .setCancelButton (None )
92- self .progress .setMinimumWidth (400 )
93- self .progress .setMinimumHeight (100 )
94- self .progress .setStyleSheet ("""
95- QProgressBar {
96- border: 1px solid #cccccc;
97- border-radius: 4px;
98- text-align: center;
99- background-color: #f0f0f0;
100- min-width: 250px;
101- min-height: 20px;
102- }
103- QProgressBar::chunk {
104- background-color: #007bff;
105- border-radius: 3px;
106- }
107- """ )
94+ self .progress = create_progress_dialog (self , "RevEng.AI" , "Loading available models..." )
10895
10996 self .model_thread = ModelLoadThread (self .uploader , self .bv )
11097 self .model_thread .finished .connect (self ._on_models_loaded )
11198 self .model_thread .error .connect (self ._on_model_load_error )
11299 self .model_thread .start ()
113-
100+
114101 self .progress .show ()
102+ QCoreApplication .processEvents ()
115103
116104 def _on_models_loaded (self , models ):
117105 """Handle successful model loading"""
@@ -144,34 +132,16 @@ def upload_binary(self):
144132 )
145133 return
146134
147- # Create and show progress dialog
148- self .progress = QProgressDialog ("Uploading binary to RevEng.AI..." , None , 0 , 0 , self )
149- self .progress .setWindowTitle ("RevEng.AI Upload" )
150- self .progress .setWindowModality (Qt .WindowModal )
151- self .progress .setCancelButton (None )
152- self .progress .setMinimumWidth (400 )
153- self .progress .setMinimumHeight (100 )
154- self .progress .setStyleSheet ("""
155- QProgressBar {
156- border: 1px solid #cccccc;
157- border-radius: 4px;
158- text-align: center;
159- background-color: #f0f0f0;
160- min-width: 250px;
161- min-height: 20px;
162- }
163- QProgressBar::chunk {
164- background-color: #007bff;
165- border-radius: 3px;
166- }
167- """ )
135+ # Create and show progress dialog using utility function
136+ self .progress = create_progress_dialog (self , "RevEng.AI Upload" , "Uploading binary to RevEng.AI..." )
168137
169138 # Create and start upload thread
170139 self .upload_thread = UploadBinaryThread (self .uploader , self .bv , self .get_upload_options ())
171140 self .upload_thread .finished .connect (self ._on_upload_finished )
172141 self .upload_thread .start ()
173142
174143 self .progress .show ()
144+ QCoreApplication .processEvents ()
175145
176146 def _on_upload_finished (self , success , error_message ):
177147 """Handle upload completion"""
0 commit comments