From 5b7572c49db1ec801cb46abc7931ba314fefba77 Mon Sep 17 00:00:00 2001 From: tridn Date: Tue, 11 Apr 2023 12:07:57 +0700 Subject: [PATCH 01/11] add main application view --- app/__init__.py | 0 app/application.py | 73 +++++ app/handlers/__init__.py | 2 + app/handlers/main_handler.py | 27 ++ app/handlers/url_handler.py | 10 + app/main.py | 7 + app/ui/MainView.glade | 555 +++++++++++++++++++++++++++++++++++ app/ui/menu.xml | 16 + app/views/__init__.py | 0 app/views/main_view.py | 55 ++++ app/views/url_view.py | 27 ++ 11 files changed, 772 insertions(+) create mode 100644 app/__init__.py create mode 100644 app/application.py create mode 100644 app/handlers/__init__.py create mode 100644 app/handlers/main_handler.py create mode 100644 app/handlers/url_handler.py create mode 100644 app/main.py create mode 100644 app/ui/MainView.glade create mode 100644 app/ui/menu.xml create mode 100644 app/views/__init__.py create mode 100644 app/views/main_view.py create mode 100644 app/views/url_view.py diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/application.py b/app/application.py new file mode 100644 index 0000000..37e1f12 --- /dev/null +++ b/app/application.py @@ -0,0 +1,73 @@ +import sys +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk +from views.main_view import MainView +from handlers.main_handler import MainHandler + + +class Application(Gtk.Application): + + def __init__(self, *args, **kwargs): + super().__init__( + *args, + application_id="org.example.myapp", + flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE, + **kwargs + ) + self.window = None + self.add_main_option( + "test", + ord("t"), + GLib.OptionFlags.NONE, + GLib.OptionArg.NONE, + "Command line test", + None, + ) + + def do_startup(self): + Gtk.Application.do_startup(self) + menu_xml = "" + action = Gio.SimpleAction.new("about", None) + action.connect("activate", self.on_about) + self.add_action(action) + action = Gio.SimpleAction.new("quit", None) + action.connect("activate", self.on_quit) + self.add_action(action) + with open("./ui/menu.xml", "r") as fs: + menu_xml = fs.read() + fs.close() + builder = Gtk.Builder.new_from_string(menu_xml, -1) + self.set_app_menu(builder.get_object("app-menu")) + + def do_activate(self): + # We only allow a single window and raise any existing ones + if not self.window: + # Windows are associated with the application + # when the last one is closed the application shuts down + self.builder = Gtk.Builder() + self.builder.add_from_file("./ui/MainView.glade") + self.builder.connect_signals(MainHandler()) + # self.window = MainView(application=self, title="Main Window") + self.window = self.builder.get_object("main-window") + self.window.set_application(self) + self.window.present() + + def do_command_line(self, command_line): + options = command_line.get_options_dict() + # convert GVariantDict -> GVariant -> dict + options = options.end().unpack() + + if "test" in options: + # This is printed on the main instance + print("Test argument recieved: %s" % options["test"]) + self.activate() + return 0 + + def on_about(self, *args): + about_dialog = Gtk.AboutDialog(modal=True) + about_dialog.present() + + def on_quit(self, *args): + self.quit() \ No newline at end of file diff --git a/app/handlers/__init__.py b/app/handlers/__init__.py new file mode 100644 index 0000000..591da42 --- /dev/null +++ b/app/handlers/__init__.py @@ -0,0 +1,2 @@ +from . import url_handler +from . import main_handler \ No newline at end of file diff --git a/app/handlers/main_handler.py b/app/handlers/main_handler.py new file mode 100644 index 0000000..6b74a20 --- /dev/null +++ b/app/handlers/main_handler.py @@ -0,0 +1,27 @@ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk +from handlers.url_handler import UrlHandler +from views.url_view import UrlView + +class MainHandler: + + def __init__(self): + self.builder = Gtk.Builder() + + def on_add_url_pressed(self, *args): + builder = Gtk.Builder() + url_dialog = UrlView() + url_dialog.present() + + def add_proxy_pressed(self, *args): + proxy_dialog = self.builder.add_from_file("../ui/ProxyView.glade") + window = proxy_dialog.get_object("proxy-view") + window.show_all() + + def on_kill_drive_pressed(self, *args): + pass + + def on_settings_pressed(self, *args): + pass \ No newline at end of file diff --git a/app/handlers/url_handler.py b/app/handlers/url_handler.py new file mode 100644 index 0000000..d9b7187 --- /dev/null +++ b/app/handlers/url_handler.py @@ -0,0 +1,10 @@ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk + + +class UrlHandler: + + def find_url_pressed(self, *args): + pass \ No newline at end of file diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..bf413ce --- /dev/null +++ b/app/main.py @@ -0,0 +1,7 @@ +import sys +from application import Application + +if __name__ == '__main__': + app = Application() + exit_status = app.run(sys.argv) + sys.exit(exit_status) diff --git a/app/ui/MainView.glade b/app/ui/MainView.glade new file mode 100644 index 0000000..ed568ad --- /dev/null +++ b/app/ui/MainView.glade @@ -0,0 +1,555 @@ + + + + + + False + 900 + 600 + + + + True + False + + + Kill drive + True + True + True + center + center + + + + 7 + 2 + + + + + Settings + True + True + True + center + center + + + + 10 + 2 + + + + + Add URL + True + True + True + center + center + + + + 4 + 2 + + + + + Add proxy + True + True + True + center + center + + + + 1 + 2 + + + + + True + False + + + 2 + 2 + + + + + True + False + + + 3 + 2 + + + + + True + False + + + 5 + 2 + + + + + True + False + + + 6 + 2 + + + + + True + False + 7 + + + 8 + 2 + + + + + True + False + 7 + + + 9 + 2 + + + + + True + False + + + 11 + 2 + + + + + True + False + + + 0 + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/ui/menu.xml b/app/ui/menu.xml new file mode 100644 index 0000000..3686e05 --- /dev/null +++ b/app/ui/menu.xml @@ -0,0 +1,16 @@ + + + +
+ + app.about + _About + + + app.quit + _Quit + <Primary>q + +
+
+
\ No newline at end of file diff --git a/app/views/__init__.py b/app/views/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/views/main_view.py b/app/views/main_view.py new file mode 100644 index 0000000..569b510 --- /dev/null +++ b/app/views/main_view.py @@ -0,0 +1,55 @@ +import sys +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk + + +class Handler: + pass + +class MainView(Gtk.ApplicationWindow): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + main_layout = Gtk.VBox(False, 3) + btn_layout = Gtk.Grid(False, 12, 12) + btn_layout + add_proxy_btn = Gtk.Button() + + # This will be in the windows group and have the "win" prefix + max_action = Gio.SimpleAction.new_stateful( + "maximize", None, GLib.Variant.new_boolean(False) + ) + max_action.connect("change-state", self.on_maximize_toggle) + self.add_action(max_action) + # Keep it in sync with the actual state + self.connect( + "notify::is-maximized", + lambda obj, pspec: max_action.set_state( + GLib.Variant.new_boolean(obj.props.is_maximized) + ), + ) + lbl_variant = GLib.Variant.new_string("String 1") + lbl_action = Gio.SimpleAction.new_stateful( + "change_label", lbl_variant.get_type(), lbl_variant + ) + lbl_action.connect("change-state", self.on_change_label_state) + self.add_action(lbl_action) + self.label = Gtk.Label(label=lbl_variant.get_string(), margin=30) + self.add(self.label) + self.label.show() + + self.set_default_size(800, 600) + + def on_change_label_state(self, action, value): + action.set_state(value) + self.label.set_text(value.get_string()) + + def on_maximize_toggle(self, action, value): + action.set_state(value) + if value.get_boolean(): + self.maximize() + else: + self.unmaximize() diff --git a/app/views/url_view.py b/app/views/url_view.py new file mode 100644 index 0000000..2904438 --- /dev/null +++ b/app/views/url_view.py @@ -0,0 +1,27 @@ +import sys +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk + + +class UrlView(Gtk.Dialog): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + main_layout = self.get_content_area() + file_url_box = Gtk.Box(spacing=6) + + self.add_buttons( + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK + ) + file_import_btn = Gtk.Button("Import URL file") + file_import_btn.connect("clicked", self.on_import_clicked) + file_url_box.pack_start(file_import_btn, True, True, 0) + main_layout.add(file_url_box) + self.set_default_size(500, 300) + self.show_all() + + def on_import_clicked(self, *args): + pass \ No newline at end of file From 738b03c3d874ef61129f9b6bdf44b111b2ec8067 Mon Sep 17 00:00:00 2001 From: tridn Date: Fri, 14 Apr 2023 05:24:50 +0700 Subject: [PATCH 02/11] modify url and proxy views --- app/handlers/main_handler.py | 7 ++-- app/utils/constants.py | 6 +++ app/views/proxy_view.py | 74 ++++++++++++++++++++++++++++++++++++ app/views/url_view.py | 17 +++++++-- 4 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 app/utils/constants.py create mode 100644 app/views/proxy_view.py diff --git a/app/handlers/main_handler.py b/app/handlers/main_handler.py index 6b74a20..f608d6d 100644 --- a/app/handlers/main_handler.py +++ b/app/handlers/main_handler.py @@ -4,6 +4,7 @@ from gi.repository import GLib, Gio, Gtk from handlers.url_handler import UrlHandler from views.url_view import UrlView +from views.proxy_view import ProxyView class MainHandler: @@ -11,14 +12,12 @@ def __init__(self): self.builder = Gtk.Builder() def on_add_url_pressed(self, *args): - builder = Gtk.Builder() url_dialog = UrlView() url_dialog.present() def add_proxy_pressed(self, *args): - proxy_dialog = self.builder.add_from_file("../ui/ProxyView.glade") - window = proxy_dialog.get_object("proxy-view") - window.show_all() + proxy_dialog = ProxyView() + proxy_dialog.present() def on_kill_drive_pressed(self, *args): pass diff --git a/app/utils/constants.py b/app/utils/constants.py new file mode 100644 index 0000000..ec11a9e --- /dev/null +++ b/app/utils/constants.py @@ -0,0 +1,6 @@ +import os + +cur_dir = os.getcwd() + +URL_FILE_DIR = f"{cur_dir}/urls.txt" +PROXY_FILE_DIR = f"{cur_dir}/proxy.txt" \ No newline at end of file diff --git a/app/views/proxy_view.py b/app/views/proxy_view.py new file mode 100644 index 0000000..008ad51 --- /dev/null +++ b/app/views/proxy_view.py @@ -0,0 +1,74 @@ +import sys +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk +from utils.constants import PROXY_FILE_DIR + + +class ProxyView(Gtk.Dialog): + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + main_layout = self.get_content_area() + file_url_box = Gtk.Box(spacing=6) + grid = Gtk.Grid() + + text_filter = Gtk.FileFilter() + text_filter.set_name("Text files") + text_filter.add_mime_type("text/*") + all_filter = Gtk.FileFilter() + all_filter.set_name("All files") + all_filter.add_pattern("*") + + file_select_label = Gtk.Label(label="Import Proxy file") + file_select_btn = Gtk.FileChooserButton("Import Proxy file") + file_select_btn.add_filter(all_filter) + file_select_btn.add_filter(text_filter) + file_select_btn.connect("selection-changed", self.on_file_selected) + + scrolledwindow = Gtk.ScrolledWindow() + scrolledwindow.set_hexpand(True) + scrolledwindow.set_vexpand(True) + grid.attach(scrolledwindow, 0, 1, 3, 1) + + proxy_text = Gtk.TextView() + self.proxy_text_buffer = proxy_text.get_buffer() + scrolledwindow.add(proxy_text) + file_url_box.pack_start(file_select_label, True, True, 0) + file_url_box.pack_start(file_select_btn, True, True, 0) + + import_btn = Gtk.Button("Import") + import_btn.connect("clicked", self.on_file_selected) + self.add_buttons( + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Import", Gtk.ResponseType.OK + ) + + main_layout.add(file_url_box) + main_layout.add(grid) + self.set_default_size(500, 300) + self.show_all() + + response = self.run() + if response == Gtk.ResponseType.OK: + self.on_import_clicked() + elif response == Gtk.ResponseType.CANCEL: + self.destroy() + + def on_file_selected(self, widget): + file_name = widget.get_filename() + proxy_list = "" + with open(file_name, "r") as f: + proxy_list = f.read() + f.close() + self.proxy_text_buffer.set_text(proxy_list) + + def on_import_clicked(self, *args): + iter_start = self.proxy_text_buffer.get_start_iter() + iter_end = self.proxy_text_buffer.get_end_iter() + proxy_list = self.proxy_text_buffer.get_text(iter_start, iter_end, False) + with open(PROXY_FILE_DIR, "w") as fs: + fs.write(proxy_list) + fs.close() + self.destroy() \ No newline at end of file diff --git a/app/views/url_view.py b/app/views/url_view.py index 2904438..a574d4e 100644 --- a/app/views/url_view.py +++ b/app/views/url_view.py @@ -16,12 +16,23 @@ def __init__(self, *args, **kwargs): self.add_buttons( Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OK, Gtk.ResponseType.OK ) - file_import_btn = Gtk.Button("Import URL file") - file_import_btn.connect("clicked", self.on_import_clicked) + text_filter = Gtk.FileFilter() + text_filter.set_name("Text files") + text_filter.add_mime_type("text/*") + all_filter = Gtk.FileFilter() + all_filter.set_name("All files") + all_filter.add_pattern("*") + + file_import_label = Gtk.Label(label="Import URL file") + file_import_btn = Gtk.FileChooserButton("Import URL file") + file_import_btn.add_filter(text_filter) + file_import_btn.add_filter(all_filter) + file_import_btn.connect("selection-changed", self.on_file_selected) + file_url_box.pack_start(file_import_label, True, True, 0) file_url_box.pack_start(file_import_btn, True, True, 0) main_layout.add(file_url_box) self.set_default_size(500, 300) self.show_all() - def on_import_clicked(self, *args): + def on_file_selected(self, *args): pass \ No newline at end of file From eec43af91ec0cb81a5a35e35e6da1151afcfce7e Mon Sep 17 00:00:00 2001 From: tridn Date: Fri, 14 Apr 2023 20:04:29 +0700 Subject: [PATCH 03/11] add setting view --- app/handlers/main_handler.py | 8 +- app/handlers/setting_handler.py | 22 +++++ app/handlers/url_handler.py | 10 --- app/ui/SettingView.glade | 154 ++++++++++++++++++++++++++++++++ app/utils/constants.py | 8 +- app/views/proxy_view.py | 21 ++++- 6 files changed, 208 insertions(+), 15 deletions(-) create mode 100644 app/handlers/setting_handler.py delete mode 100644 app/handlers/url_handler.py create mode 100644 app/ui/SettingView.glade diff --git a/app/handlers/main_handler.py b/app/handlers/main_handler.py index f608d6d..9d15f4a 100644 --- a/app/handlers/main_handler.py +++ b/app/handlers/main_handler.py @@ -2,7 +2,7 @@ gi.require_version("Gtk", "3.0") from gi.repository import GLib, Gio, Gtk -from handlers.url_handler import UrlHandler +from handlers.setting_handler import SettingHandler from views.url_view import UrlView from views.proxy_view import ProxyView @@ -23,4 +23,8 @@ def on_kill_drive_pressed(self, *args): pass def on_settings_pressed(self, *args): - pass \ No newline at end of file + builder = Gtk.Builder() + builder.add_from_file("./ui/SettingView.glade") + builder.connect_signals(SettingHandler()) + window = builder.get_object("setting-view") + window.show_all() \ No newline at end of file diff --git a/app/handlers/setting_handler.py b/app/handlers/setting_handler.py new file mode 100644 index 0000000..2f6f523 --- /dev/null +++ b/app/handlers/setting_handler.py @@ -0,0 +1,22 @@ +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import GLib, Gio, Gtk + + +class SettingHandler: + + def on_database_toggled(self, *args): + pass + + def on_http_toggled(self, *args): + pass + + def on_proxy_manual_toggled(self, *args): + pass + + def on_apply_setting_clicked(self, *args): + pass + + def on_setting_cancel_clicked(self, *args): + pass \ No newline at end of file diff --git a/app/handlers/url_handler.py b/app/handlers/url_handler.py deleted file mode 100644 index d9b7187..0000000 --- a/app/handlers/url_handler.py +++ /dev/null @@ -1,10 +0,0 @@ -import gi - -gi.require_version("Gtk", "3.0") -from gi.repository import GLib, Gio, Gtk - - -class UrlHandler: - - def find_url_pressed(self, *args): - pass \ No newline at end of file diff --git a/app/ui/SettingView.glade b/app/ui/SettingView.glade new file mode 100644 index 0000000..6ae02f8 --- /dev/null +++ b/app/ui/SettingView.glade @@ -0,0 +1,154 @@ + + + + + + False + dialog + + + False + vertical + 2 + + + False + end + + + button + True + True + True + + + False + True + 0 + + + + + apply + True + True + True + + + + False + True + end + 1 + + + + + False + False + 0 + + + + + True + False + vertical + + + Store database + True + True + False + True + + + + False + True + 0 + + + + + HTTP + True + True + False + True + + + + False + True + 1 + + + + + manual proxy + True + True + False + True + + + + False + True + 2 + + + + + True + False + + + 50 + 20 + True + True + + + 35 + 1 + + + + + 30 + 20 + True + False + Port + + + 1 + 1 + + + + + False + True + 3 + + + + + + + + + + + False + True + 1 + + + + + + diff --git a/app/utils/constants.py b/app/utils/constants.py index ec11a9e..0e27eac 100644 --- a/app/utils/constants.py +++ b/app/utils/constants.py @@ -3,4 +3,10 @@ cur_dir = os.getcwd() URL_FILE_DIR = f"{cur_dir}/urls.txt" -PROXY_FILE_DIR = f"{cur_dir}/proxy.txt" \ No newline at end of file +PROXY_FILE_DIR = f"{cur_dir}/proxy.txt" +PROXY_TYPES = [ + "HTTP", + "SOCKS4", + "SOCKS5", + "ALL" +] \ No newline at end of file diff --git a/app/views/proxy_view.py b/app/views/proxy_view.py index 008ad51..ce6cba8 100644 --- a/app/views/proxy_view.py +++ b/app/views/proxy_view.py @@ -3,7 +3,7 @@ gi.require_version("Gtk", "3.0") from gi.repository import GLib, Gio, Gtk -from utils.constants import PROXY_FILE_DIR +from utils.constants import PROXY_FILE_DIR, PROXY_TYPES class ProxyView(Gtk.Dialog): @@ -28,6 +28,17 @@ def __init__(self, *args, **kwargs): file_select_btn.add_filter(text_filter) file_select_btn.connect("selection-changed", self.on_file_selected) + proxy_store = Gtk.ListStore(str) + + for proxy_type in PROXY_TYPES: + proxy_store.append([proxy_type]) + + country_combo = Gtk.ComboBox.new_with_model(proxy_store) + country_combo.connect("changed", self.on_country_combo_changed) + renderer_text = Gtk.CellRendererText() + country_combo.pack_start(renderer_text, True) + country_combo.add_attribute(renderer_text, "text", 0) + scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_hexpand(True) scrolledwindow.set_vexpand(True) @@ -71,4 +82,10 @@ def on_import_clicked(self, *args): with open(PROXY_FILE_DIR, "w") as fs: fs.write(proxy_list) fs.close() - self.destroy() \ No newline at end of file + self.destroy() + + def on_proxy_combo_changed(self, combo): + tree_iter = combo.get_active_iter() + if tree_iter is not None: + instance = combo.get_model() + country = instance[tree_iter][0] \ No newline at end of file From 5b69b83b246f6c7479d62dc6a3ba3619ca05510d Mon Sep 17 00:00:00 2001 From: tridn Date: Sat, 15 Apr 2023 16:49:58 +0700 Subject: [PATCH 04/11] apply join path system method --- app/utils/constants.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/constants.py b/app/utils/constants.py index 0e27eac..356c9e6 100644 --- a/app/utils/constants.py +++ b/app/utils/constants.py @@ -2,8 +2,8 @@ cur_dir = os.getcwd() -URL_FILE_DIR = f"{cur_dir}/urls.txt" -PROXY_FILE_DIR = f"{cur_dir}/proxy.txt" +URL_FILE_DIR = os.path.join(cur_dir, "urls.txt") +PROXY_FILE_DIR = os.path.join(cur_dir, "proxy.txt") PROXY_TYPES = [ "HTTP", "SOCKS4", From d290cafef621e5047ea02f1369a82db375cbc438 Mon Sep 17 00:00:00 2001 From: tridn Date: Sat, 15 Apr 2023 17:23:29 +0700 Subject: [PATCH 05/11] fix typo --- app/handlers/__init__.py | 2 -- app/views/proxy_view.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/handlers/__init__.py b/app/handlers/__init__.py index 591da42..e69de29 100644 --- a/app/handlers/__init__.py +++ b/app/handlers/__init__.py @@ -1,2 +0,0 @@ -from . import url_handler -from . import main_handler \ No newline at end of file diff --git a/app/views/proxy_view.py b/app/views/proxy_view.py index ce6cba8..5591e30 100644 --- a/app/views/proxy_view.py +++ b/app/views/proxy_view.py @@ -34,7 +34,7 @@ def __init__(self, *args, **kwargs): proxy_store.append([proxy_type]) country_combo = Gtk.ComboBox.new_with_model(proxy_store) - country_combo.connect("changed", self.on_country_combo_changed) + country_combo.connect("changed", self.on_proxy_combo_changed) renderer_text = Gtk.CellRendererText() country_combo.pack_start(renderer_text, True) country_combo.add_attribute(renderer_text, "text", 0) From f16a777dcb4f54c95b290adc0c43d26300dadb6e Mon Sep 17 00:00:00 2001 From: tridn Date: Sun, 16 Apr 2023 04:47:04 +0700 Subject: [PATCH 06/11] modify setting view --- app/application.py | 2 - app/handlers/main_handler.py | 17 +- app/handlers/setting_handler.py | 6 - app/ui/MainView.glade | 2 +- app/ui/SettingView.glade | 306 +++++++++++++++++++++++++------- app/views/main_view.py | 55 ------ app/views/proxy_view.py | 2 + app/views/setting_view.py | 22 +++ 8 files changed, 282 insertions(+), 130 deletions(-) delete mode 100644 app/views/main_view.py create mode 100644 app/views/setting_view.py diff --git a/app/application.py b/app/application.py index 37e1f12..5f9fc0c 100644 --- a/app/application.py +++ b/app/application.py @@ -3,7 +3,6 @@ gi.require_version("Gtk", "3.0") from gi.repository import GLib, Gio, Gtk -from views.main_view import MainView from handlers.main_handler import MainHandler @@ -49,7 +48,6 @@ def do_activate(self): self.builder = Gtk.Builder() self.builder.add_from_file("./ui/MainView.glade") self.builder.connect_signals(MainHandler()) - # self.window = MainView(application=self, title="Main Window") self.window = self.builder.get_object("main-window") self.window.set_application(self) self.window.present() diff --git a/app/handlers/main_handler.py b/app/handlers/main_handler.py index 9d15f4a..8d6a7df 100644 --- a/app/handlers/main_handler.py +++ b/app/handlers/main_handler.py @@ -2,9 +2,10 @@ gi.require_version("Gtk", "3.0") from gi.repository import GLib, Gio, Gtk -from handlers.setting_handler import SettingHandler +from views.setting_view import SettingView from views.url_view import UrlView from views.proxy_view import ProxyView +from youtubeviewer.config import create_config class MainHandler: @@ -23,8 +24,12 @@ def on_kill_drive_pressed(self, *args): pass def on_settings_pressed(self, *args): - builder = Gtk.Builder() - builder.add_from_file("./ui/SettingView.glade") - builder.connect_signals(SettingHandler()) - window = builder.get_object("setting-view") - window.show_all() \ No newline at end of file + setting_dialog = SettingView() + response = setting_dialog.run() + if response == Gtk.ResponseType.OK: + print("OK button clicked") + print(setting_dialog.__dict__) + else: + print("Dialog closed") + + setting_dialog.destroy() \ No newline at end of file diff --git a/app/handlers/setting_handler.py b/app/handlers/setting_handler.py index 2f6f523..becaddc 100644 --- a/app/handlers/setting_handler.py +++ b/app/handlers/setting_handler.py @@ -14,9 +14,3 @@ def on_http_toggled(self, *args): def on_proxy_manual_toggled(self, *args): pass - - def on_apply_setting_clicked(self, *args): - pass - - def on_setting_cancel_clicked(self, *args): - pass \ No newline at end of file diff --git a/app/ui/MainView.glade b/app/ui/MainView.glade index ed568ad..c6459d5 100644 --- a/app/ui/MainView.glade +++ b/app/ui/MainView.glade @@ -2,7 +2,7 @@ - + False 900 600 diff --git a/app/ui/SettingView.glade b/app/ui/SettingView.glade index 6ae02f8..c340dc3 100644 --- a/app/ui/SettingView.glade +++ b/app/ui/SettingView.glade @@ -2,51 +2,151 @@ - + + True False - dialog - - - False - vertical - 2 - - + vertical + + + True + True + + + + 14 + True False - end - - button + + Store database True True - True + False + True + - False - True - 0 + 0 + 0 - - apply + + HTTP True True - True - + False + True + - False - True - end - 1 + 0 + 1 + + + + + 32 + 32 + True + False + + + 50 + 7 + True + True + + + 35 + 1 + + + + + 30 + 20 + True + False + Port + + + 1 + 1 + + + + + 0 + 2 + + + + + Headless + True + True + False + True + + + 0 + 3 + + + Bandwidth reduction + True + True + False + True + + + 0 + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + False + General - False - False - 0 + False @@ -55,13 +155,13 @@ False vertical - - Store database + + manual proxy True True False True - + False @@ -70,85 +170,171 @@ - - HTTP + + + + + + + + 1 + + + + + True + False + Proxy + + + 1 + False + + + + + True + False + vertical + + True - True - False - True - + False + + + 50 + 20 + True + True + Default is 85 mins + + + 80 + 1 + + + + + 30 + 20 + True + False + Min duration + + + 1 + 8 + + False True - 1 + 0 - - manual proxy + True - True - False - True - + False + + + 50 + 20 + True + True + Default is 95 mins + + + 80 + 1 + + + + + 30 + 20 + True + False + Max duration + + + 1 + 8 + + False True - 2 + 1 - + True False - + 50 20 True True + Default is 100 views - 35 + 80 1 - + 30 20 True False - Port + Viewers 1 - 1 + 8 False True - 3 + 2 - - - - - - - False - True - 1 + 2 + + + + + True + False + Viewership + + + 2 + False + + False + True + 0 + + + + + + + diff --git a/app/views/main_view.py b/app/views/main_view.py deleted file mode 100644 index 569b510..0000000 --- a/app/views/main_view.py +++ /dev/null @@ -1,55 +0,0 @@ -import sys -import gi - -gi.require_version("Gtk", "3.0") -from gi.repository import GLib, Gio, Gtk - - -class Handler: - pass - -class MainView(Gtk.ApplicationWindow): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - main_layout = Gtk.VBox(False, 3) - btn_layout = Gtk.Grid(False, 12, 12) - btn_layout - add_proxy_btn = Gtk.Button() - - # This will be in the windows group and have the "win" prefix - max_action = Gio.SimpleAction.new_stateful( - "maximize", None, GLib.Variant.new_boolean(False) - ) - max_action.connect("change-state", self.on_maximize_toggle) - self.add_action(max_action) - # Keep it in sync with the actual state - self.connect( - "notify::is-maximized", - lambda obj, pspec: max_action.set_state( - GLib.Variant.new_boolean(obj.props.is_maximized) - ), - ) - lbl_variant = GLib.Variant.new_string("String 1") - lbl_action = Gio.SimpleAction.new_stateful( - "change_label", lbl_variant.get_type(), lbl_variant - ) - lbl_action.connect("change-state", self.on_change_label_state) - self.add_action(lbl_action) - self.label = Gtk.Label(label=lbl_variant.get_string(), margin=30) - self.add(self.label) - self.label.show() - - self.set_default_size(800, 600) - - def on_change_label_state(self, action, value): - action.set_state(value) - self.label.set_text(value.get_string()) - - def on_maximize_toggle(self, action, value): - action.set_state(value) - if value.get_boolean(): - self.maximize() - else: - self.unmaximize() diff --git a/app/views/proxy_view.py b/app/views/proxy_view.py index 5591e30..3b6b02b 100644 --- a/app/views/proxy_view.py +++ b/app/views/proxy_view.py @@ -10,6 +10,8 @@ class ProxyView(Gtk.Dialog): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + print(args) + print(kwargs) main_layout = self.get_content_area() file_url_box = Gtk.Box(spacing=6) diff --git a/app/views/setting_view.py b/app/views/setting_view.py new file mode 100644 index 0000000..a05e4f9 --- /dev/null +++ b/app/views/setting_view.py @@ -0,0 +1,22 @@ +import sys +import gi + +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk +from handlers.setting_handler import SettingHandler + + +class SettingView(Gtk.Dialog): + + def __init__(self, *args, **kwargs): + Gtk.Dialog.__init__(self, *args, **kwargs) + builder = Gtk.Builder() + builder.add_from_file("./ui/SettingView.glade") + builder.connect_signals(SettingHandler()) + self.dialog = builder.get_object("setting-view") + apply_btn = Gtk.Button(label="Apply") + self.add_buttons( + Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Apply", Gtk.ResponseType.OK + ) + self.get_content_area().add(self.dialog) + self.set_default_size(500, 300) From b19289eff1cd50170752248a4718368b0f44de42 Mon Sep 17 00:00:00 2001 From: tridn Date: Sun, 16 Apr 2023 08:15:51 +0700 Subject: [PATCH 07/11] refactoring --- app/utils/constants.py | 12 ------------ app/views/__init__.py | 0 app/application.py => application.py | 4 ++-- {app => handlers}/__init__.py | 0 {app/handlers => handlers}/main_handler.py | 0 {app/handlers => handlers}/setting_handler.py | 0 app/main.py => main.py | 0 {app/ui => ui}/MainView.glade | 0 {app/ui => ui}/SettingView.glade | 0 {app/ui => ui}/menu.xml | 0 utils/constants.py | 16 ++++++++++++++++ {app/handlers => views}/__init__.py | 0 {app/views => views}/proxy_view.py | 0 {app/views => views}/setting_view.py | 4 ++-- {app/views => views}/url_view.py | 0 15 files changed, 20 insertions(+), 16 deletions(-) delete mode 100644 app/utils/constants.py delete mode 100644 app/views/__init__.py rename app/application.py => application.py (95%) rename {app => handlers}/__init__.py (100%) rename {app/handlers => handlers}/main_handler.py (100%) rename {app/handlers => handlers}/setting_handler.py (100%) rename app/main.py => main.py (100%) rename {app/ui => ui}/MainView.glade (100%) rename {app/ui => ui}/SettingView.glade (100%) rename {app/ui => ui}/menu.xml (100%) create mode 100644 utils/constants.py rename {app/handlers => views}/__init__.py (100%) rename {app/views => views}/proxy_view.py (100%) rename {app/views => views}/setting_view.py (87%) rename {app/views => views}/url_view.py (100%) diff --git a/app/utils/constants.py b/app/utils/constants.py deleted file mode 100644 index 356c9e6..0000000 --- a/app/utils/constants.py +++ /dev/null @@ -1,12 +0,0 @@ -import os - -cur_dir = os.getcwd() - -URL_FILE_DIR = os.path.join(cur_dir, "urls.txt") -PROXY_FILE_DIR = os.path.join(cur_dir, "proxy.txt") -PROXY_TYPES = [ - "HTTP", - "SOCKS4", - "SOCKS5", - "ALL" -] \ No newline at end of file diff --git a/app/views/__init__.py b/app/views/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/application.py b/application.py similarity index 95% rename from app/application.py rename to application.py index 5f9fc0c..3a28425 100644 --- a/app/application.py +++ b/application.py @@ -4,7 +4,7 @@ gi.require_version("Gtk", "3.0") from gi.repository import GLib, Gio, Gtk from handlers.main_handler import MainHandler - +from utils.constants import MAINVIEW_DIR class Application(Gtk.Application): @@ -46,7 +46,7 @@ def do_activate(self): # Windows are associated with the application # when the last one is closed the application shuts down self.builder = Gtk.Builder() - self.builder.add_from_file("./ui/MainView.glade") + self.builder.add_from_file(MAINVIEW_DIR) self.builder.connect_signals(MainHandler()) self.window = self.builder.get_object("main-window") self.window.set_application(self) diff --git a/app/__init__.py b/handlers/__init__.py similarity index 100% rename from app/__init__.py rename to handlers/__init__.py diff --git a/app/handlers/main_handler.py b/handlers/main_handler.py similarity index 100% rename from app/handlers/main_handler.py rename to handlers/main_handler.py diff --git a/app/handlers/setting_handler.py b/handlers/setting_handler.py similarity index 100% rename from app/handlers/setting_handler.py rename to handlers/setting_handler.py diff --git a/app/main.py b/main.py similarity index 100% rename from app/main.py rename to main.py diff --git a/app/ui/MainView.glade b/ui/MainView.glade similarity index 100% rename from app/ui/MainView.glade rename to ui/MainView.glade diff --git a/app/ui/SettingView.glade b/ui/SettingView.glade similarity index 100% rename from app/ui/SettingView.glade rename to ui/SettingView.glade diff --git a/app/ui/menu.xml b/ui/menu.xml similarity index 100% rename from app/ui/menu.xml rename to ui/menu.xml diff --git a/utils/constants.py b/utils/constants.py new file mode 100644 index 0000000..e394027 --- /dev/null +++ b/utils/constants.py @@ -0,0 +1,16 @@ +import os +from pathlib import Path + +cur_abs_path = Path(os.path.abspath(__file__)) + +BASE_DIR = cur_abs_path.parents[2] +URL_FILE_DIR = os.path.join(BASE_DIR, "urls.txt") +PROXY_FILE_DIR = os.path.join(BASE_DIR, "proxy.txt") +MAINVIEW_DIR = os.path.join(BASE_DIR, "app/ui/MainView.glade") +SETTINGVIEW_DIR = os.path.join(BASE_DIR, "app/ui/SettingView.glade") +PROXY_TYPES = [ + "HTTP", + "SOCKS4", + "SOCKS5", + "ALL" +] \ No newline at end of file diff --git a/app/handlers/__init__.py b/views/__init__.py similarity index 100% rename from app/handlers/__init__.py rename to views/__init__.py diff --git a/app/views/proxy_view.py b/views/proxy_view.py similarity index 100% rename from app/views/proxy_view.py rename to views/proxy_view.py diff --git a/app/views/setting_view.py b/views/setting_view.py similarity index 87% rename from app/views/setting_view.py rename to views/setting_view.py index a05e4f9..df4414d 100644 --- a/app/views/setting_view.py +++ b/views/setting_view.py @@ -4,14 +4,14 @@ gi.require_version("Gtk", "3.0") from gi.repository import Gtk from handlers.setting_handler import SettingHandler - +from utils.constants import SETTINGVIEW_DIR class SettingView(Gtk.Dialog): def __init__(self, *args, **kwargs): Gtk.Dialog.__init__(self, *args, **kwargs) builder = Gtk.Builder() - builder.add_from_file("./ui/SettingView.glade") + builder.add_from_file(SETTINGVIEW_DIR) builder.connect_signals(SettingHandler()) self.dialog = builder.get_object("setting-view") apply_btn = Gtk.Button(label="Apply") diff --git a/app/views/url_view.py b/views/url_view.py similarity index 100% rename from app/views/url_view.py rename to views/url_view.py From dd9014c0c37813eca58f3e177891066f6b828d63 Mon Sep 17 00:00:00 2001 From: tridn Date: Sun, 16 Apr 2023 08:17:39 +0700 Subject: [PATCH 08/11] change project directory --- utils/constants.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/constants.py b/utils/constants.py index e394027..4472050 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -3,11 +3,11 @@ cur_abs_path = Path(os.path.abspath(__file__)) -BASE_DIR = cur_abs_path.parents[2] +BASE_DIR = cur_abs_path.parents[1] URL_FILE_DIR = os.path.join(BASE_DIR, "urls.txt") PROXY_FILE_DIR = os.path.join(BASE_DIR, "proxy.txt") -MAINVIEW_DIR = os.path.join(BASE_DIR, "app/ui/MainView.glade") -SETTINGVIEW_DIR = os.path.join(BASE_DIR, "app/ui/SettingView.glade") +MAINVIEW_DIR = os.path.join(BASE_DIR, "ui/MainView.glade") +SETTINGVIEW_DIR = os.path.join(BASE_DIR, "ui/SettingView.glade") PROXY_TYPES = [ "HTTP", "SOCKS4", From 5567f18f93471cf592532a4d25dc07e0beb85b0e Mon Sep 17 00:00:00 2001 From: tridn Date: Mon, 17 Apr 2023 04:38:07 +0700 Subject: [PATCH 09/11] add run button --- application.py | 6 + handlers/main_handler.py | 11 +- ui/MainView.glade | 535 +++------------------------------------ utils/constants.py | 1 + 4 files changed, 54 insertions(+), 499 deletions(-) diff --git a/application.py b/application.py index 3a28425..88af276 100644 --- a/application.py +++ b/application.py @@ -2,6 +2,7 @@ import gi gi.require_version("Gtk", "3.0") +# gi.require_version('WebKit', '3.0') from gi.repository import GLib, Gio, Gtk from handlers.main_handler import MainHandler from utils.constants import MAINVIEW_DIR @@ -49,6 +50,11 @@ def do_activate(self): self.builder.add_from_file(MAINVIEW_DIR) self.builder.connect_signals(MainHandler()) self.window = self.builder.get_object("main-window") + # self.webview = WebKit.WebView() + # scrolled_window = self.builder.get_object("web-view") + # scrolled_window.add(self.webview) + # self.webview.load_uri("http://localhost:5000") + # self.add(scrolled_window) self.window.set_application(self) self.window.present() diff --git a/handlers/main_handler.py b/handlers/main_handler.py index 8d6a7df..8d8ca57 100644 --- a/handlers/main_handler.py +++ b/handlers/main_handler.py @@ -6,6 +6,8 @@ from views.url_view import UrlView from views.proxy_view import ProxyView from youtubeviewer.config import create_config +from utils.constants import BATCH_FILE_DIR +# from youtube_viewer import main class MainHandler: @@ -20,9 +22,6 @@ def add_proxy_pressed(self, *args): proxy_dialog = ProxyView() proxy_dialog.present() - def on_kill_drive_pressed(self, *args): - pass - def on_settings_pressed(self, *args): setting_dialog = SettingView() response = setting_dialog.run() @@ -32,4 +31,8 @@ def on_settings_pressed(self, *args): else: print("Dialog closed") - setting_dialog.destroy() \ No newline at end of file + setting_dialog.destroy() + + def on_run_clicked(self, *args): + # main() + pass diff --git a/ui/MainView.glade b/ui/MainView.glade index c6459d5..c3ea292 100644 --- a/ui/MainView.glade +++ b/ui/MainView.glade @@ -7,43 +7,33 @@ 900 600 - - + + 900 + 600 True False - - Kill drive - True - True - True - center - center - - - - 7 - 2 - - - - - Settings + + Add proxy + 40 + 30 True True True center center - + - 10 - 2 + 10 + 20 Add URL + 40 + 30 True True True @@ -52,503 +42,58 @@ - 4 - 2 + 120 + 20 - - Add proxy + + Settings + 40 + 30 True True True center center - - - - 1 - 2 - - - - - True - False - - - 2 - 2 - - - - - True - False - - - 3 - 2 - - - - - True - False - - - 5 - 2 - - - - - True - False - - - 6 - 2 - - - - - True - False - 7 - - - 8 - 2 - - - - - True - False - 7 + - 9 - 2 + 340 + 20 - + + run + 40 + 30 True - False + True + True + - 11 - 2 + 600 + 100 - + + 300 + 300 True - False + True + in + + + - 0 - 2 + 230 + 230 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/utils/constants.py b/utils/constants.py index 4472050..5e0a2bb 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -8,6 +8,7 @@ PROXY_FILE_DIR = os.path.join(BASE_DIR, "proxy.txt") MAINVIEW_DIR = os.path.join(BASE_DIR, "ui/MainView.glade") SETTINGVIEW_DIR = os.path.join(BASE_DIR, "ui/SettingView.glade") +BATCH_FILE_DIR = os.path.join(BASE_DIR, "killdrive.bat") PROXY_TYPES = [ "HTTP", "SOCKS4", From c1e962207fcdd3c9d86123dcb03c8b0907752b4a Mon Sep 17 00:00:00 2001 From: tridn Date: Mon, 17 Apr 2023 06:55:16 +0700 Subject: [PATCH 10/11] modify directories for pyinstaller --- .gitignore | 3 +++ utils/constants.py | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index a74324a..37afa4c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ config.json chromedriver.exe version.txt *.log +*.exe +build +dist \ No newline at end of file diff --git a/utils/constants.py b/utils/constants.py index 5e0a2bb..83415ec 100644 --- a/utils/constants.py +++ b/utils/constants.py @@ -1,14 +1,19 @@ -import os -from pathlib import Path +import sys, os -cur_abs_path = Path(os.path.abspath(__file__)) +BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -BASE_DIR = cur_abs_path.parents[1] -URL_FILE_DIR = os.path.join(BASE_DIR, "urls.txt") -PROXY_FILE_DIR = os.path.join(BASE_DIR, "proxy.txt") -MAINVIEW_DIR = os.path.join(BASE_DIR, "ui/MainView.glade") -SETTINGVIEW_DIR = os.path.join(BASE_DIR, "ui/SettingView.glade") -BATCH_FILE_DIR = os.path.join(BASE_DIR, "killdrive.bat") +def resource_path(relative_path): + """ Get absolute path to resource, works for dev and for PyInstaller """ + base_path = getattr(sys, '_MEIPASS', os.path.dirname(BASE_DIR)) + return os.path.join(base_path, relative_path) + + +URL_FILE_DIR = resource_path("urls.txt") +PROXY_FILE_DIR = resource_path("proxy.txt") +MAINVIEW_DIR = resource_path("ui/MainView.glade") +SETTINGVIEW_DIR = resource_path("ui/SettingView.glade") +MENU_DIR = resource_path("ui/menu.xml") +BATCH_FILE_DIR = resource_path("killdrive.bat") PROXY_TYPES = [ "HTTP", "SOCKS4", From 3135177da1619d2c3ad6f55fa56bb735c4acf8a7 Mon Sep 17 00:00:00 2001 From: tridn Date: Mon, 17 Apr 2023 06:55:46 +0700 Subject: [PATCH 11/11] spec file for pyinstaller --- application.py | 4 ++-- main.spec | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 main.spec diff --git a/application.py b/application.py index 88af276..fab5601 100644 --- a/application.py +++ b/application.py @@ -5,7 +5,7 @@ # gi.require_version('WebKit', '3.0') from gi.repository import GLib, Gio, Gtk from handlers.main_handler import MainHandler -from utils.constants import MAINVIEW_DIR +from utils.constants import MAINVIEW_DIR, MENU_DIR class Application(Gtk.Application): @@ -35,7 +35,7 @@ def do_startup(self): action = Gio.SimpleAction.new("quit", None) action.connect("activate", self.on_quit) self.add_action(action) - with open("./ui/menu.xml", "r") as fs: + with open(MENU_DIR, "r") as fs: menu_xml = fs.read() fs.close() builder = Gtk.Builder.new_from_string(menu_xml, -1) diff --git a/main.spec b/main.spec new file mode 100644 index 0000000..c9e6bd8 --- /dev/null +++ b/main.spec @@ -0,0 +1,48 @@ +# -*- mode: python ; coding: utf-8 -*- + + +block_cipher = None + + +a = Analysis( + ['main.py'], + pathex=[], + binaries=[], + datas=[ + ('ui/MainView.glade','ui'), + ('ui/SettingView.glade','ui'), + ('ui/menu.xml','ui') + ], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False, +) +pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='main', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +)