{"id":6098,"library":"pyobjc-framework-discrecordingui","title":"PyObjC DiscRecordingUI Framework","description":"PyObjC is a bidirectional bridge that allows Python programs to interact with Objective-C frameworks on macOS. This package, `pyobjc-framework-discrecordingui`, provides Python wrappers for the DiscRecordingUI framework, enabling developers to integrate disc burning and erasing user interfaces into their macOS applications. The library is actively maintained, currently at version 12.1, with releases often tied to new macOS SDK updates and Python version support cycles.","status":"active","version":"12.1","language":"en","source_language":"en","source_url":"https://github.com/ronaldoussoren/pyobjc","tags":["macos","pyobjc","disc recording","ui","framework","objective-c","cocoa"],"install":[{"cmd":"pip install pyobjc-framework-discrecordingui","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Core bridge for Python and Objective-C interaction.","package":"pyobjc-core"},{"reason":"DiscRecordingUI relies on the fundamental Cocoa framework for UI elements and application services.","package":"pyobjc-framework-Cocoa"},{"reason":"DiscRecordingUI provides UI for the DiscRecording framework's core functionality.","package":"pyobjc-framework-DiscRecording"}],"imports":[{"symbol":"DRBurnSetup","correct":"from DiscRecordingUI import DRBurnSetup"},{"symbol":"DRBurnSession","correct":"from DiscRecordingUI import DRBurnSession"},{"symbol":"DRBurnSetupPanel","correct":"from DiscRecordingUI import DRBurnSetupPanel"}],"quickstart":{"code":"import objc\nfrom Foundation import NSObject, NSApplication\nfrom AppKit import NSApplicationActivationPolicyRegular\nfrom PyObjCTools import AppHelper\nfrom DiscRecordingUI import DRBurnSetupPanel, DRBurnSetup, DRBurnCompletionAction\n\n\nclass AppDelegate(NSObject):\n    def applicationDidFinishLaunching_(self, notification):\n        print(\"Application started.\")\n        # Create a burn setup panel (example usage)\n        panel = DRBurnSetupPanel.new()\n        \n        # In a real application, you'd present this panel and handle its delegate methods\n        # For demonstration, we'll just show its existence.\n        print(f\"Created DRBurnSetupPanel: {panel}\")\n        \n        # To prevent the app from immediately quitting in a simple script,\n        # a real UI event loop is needed. For CLI demo, we can just let it exit.\n        # If you were to present a panel, you'd typically do something like:\n        # panel.beginSetupSheetForWindow_modalDelegate_didEndSelector_contextInfo_(\n        #    None, self, 'burnSetupSheetDidEnd_returnCode_contextInfo:', None)\n        \n        # For a truly minimal UI app to stay open:\n        # NSApp.run()\n\n    def applicationWillTerminate_(self, notification):\n        print(\"Application will terminate.\")\n\nif __name__ == '__main__':\n    # Initialize the NSApplication\n    app = NSApplication.sharedApplication()\n    app.setActivationPolicy_(NSApplicationActivationPolicyRegular)\n\n    # Create and set the delegate\n    delegate = AppDelegate.alloc().init()\n    app.setDelegate_(delegate)\n\n    # Run the application event loop\n    # For a real GUI app, this keeps it running.\n    # For this minimal example, it might exit quickly if no windows are shown.\n    AppHelper.runEventLoop()","lang":"python","description":"This quickstart demonstrates the basic structure of a PyObjC application, using `NSApplication` and `PyObjCTools.AppHelper` to manage the event loop. It shows how to import and instantiate a class from the `DiscRecordingUI` framework (e.g., `DRBurnSetupPanel`). In a full application, you would present UI elements and implement delegate methods to interact with them."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer, or use an older PyObjC version compatible with your Python interpreter (e.g., PyObjC 10.x for Python 3.9).","message":"PyObjC frequently drops support for older Python versions. Version 12.0 dropped support for Python 3.9, and version 11.0 dropped Python 3.8. Ensure your Python environment is compatible with the installed PyObjC version. Current releases generally support Python 3.10 and later.","severity":"breaking","affected_versions":">=11.0"},{"fix":"Consult the PyObjC documentation on 'Instantiating Objective-C objects' for current best practices. If implementing `__new__`, ensure `__init__` methods are defined in an Objective-C style to work correctly with PyObjC's bridge.","message":"Changes in `__init__` and `__new__` behavior when subclassing Objective-C classes from Python. PyObjC 10.3 introduced changes that broke `__init__` for some user-implemented `__new__` patterns, partially reverted in 10.3.1. Complex interactions with Objective-C's two-step instantiation (alloc/init) require careful handling.","severity":"breaking","affected_versions":"10.3, 10.3.1"},{"fix":"Review code interacting with Objective-C 'init' family methods, especially those that might involve manual memory management or specific retain/release patterns, to ensure compliance with ARC rules.","message":"PyObjC 11.1 aligned its Automatic Reference Counting (ARC) behavior with `clang`'s documentation for initializer methods. Methods in the 'init' family now correctly model stealing a reference to `self` and returning a new reference. This might subtly change reference counting expectations in Python code interacting with Objective-C initializers.","severity":"gotcha","affected_versions":">=11.1"},{"fix":"Avoid subclassing `NSString` or `NSMutableString`. If you need custom string behavior, consider composition or using standard Python string manipulation and conversion to/from `objc.pyobjc_unicode`.","message":"Subclassing `NSString` or `NSMutableString` directly from Python is not supported and will lead to crashes. These classes are marked as 'final' in PyObjC due to their special handling in the bridge.","severity":"gotcha","affected_versions":"All"},{"fix":"Always use the underscore-mangled versions of Objective-C method names when calling them from Python. Arguments for the Objective-C method become positional arguments after the `self` parameter in the Python method.","message":"Objective-C method names containing colons (`:`) are translated into Python method names with underscores (`_`). For example, `someMethod:withArg:` becomes `someMethod_withArg_`. This mangling is fundamental to PyObjC interaction.","severity":"gotcha","affected_versions":"All"},{"fix":"Exercise caution when using PyObjC in a free-threaded Python environment. Avoid operations identified as not thread-safe. For critical, thread-sensitive operations, consider falling back to GIL-protected execution or alternative concurrency models.","message":"PyObjC 11.0 introduced experimental support for free-threading (PEP 703) in Python 3.13. However, PyObjC does not fully support running without the Global Interpreter Lock (GIL), and some functionality explicitly marked as not thread-safe (e.g., defining Objective-C classes concurrently in multiple threads) may lead to issues.","severity":"gotcha","affected_versions":">=11.0, specifically with Python 3.13+ free-threading"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}