Title: Receive decorator events inside of class · Issue #8 · ffont/push2-python · GitHub
Open Graph Title: Receive decorator events inside of class · Issue #8 · ffont/push2-python
X Title: Receive decorator events inside of class · Issue #8 · ffont/push2-python
Description: Hey there, I would like to organize everything related to the Ableton Push interaction inside of a class named PushService. However, when the decorated function is called, I need to have access to the object's properties. How can I acces...
Open Graph Description: Hey there, I would like to organize everything related to the Ableton Push interaction inside of a class named PushService. However, when the decorated function is called, I need to have access to ...
X Description: Hey there, I would like to organize everything related to the Ableton Push interaction inside of a class named PushService. However, when the decorated function is called, I need to have access to ...
Opengraph URL: https://github.com/ffont/push2-python/issues/8
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Receive decorator events inside of class","articleBody":"Hey there,\r\n\r\nI would like to organize everything related to the Ableton Push interaction inside of a class named `PushService`. However, when the decorated function is called, I need to have access to the object's properties. How can I access `self` property inside of that function?\r\n\r\nHere's my class definition:\r\n```python\r\nclass PushService():\r\n def __init__(self, eventQueueService: EventQueueService):\r\n self.eventQueueService = eventQueueService\r\n\r\n print(\"Initializing push service...\")\r\n self.push = push2_python.Push2(run_simulator=True)\r\n\r\n # Start by setting all pad colors to white\r\n self.push.pads.set_all_pads_to_color('white')\r\n\r\n @push2_python.on_pad_pressed()\r\n def on_pad_pressed(push, pad_n, pad_ij, velocity):\r\n if pad_ij == (7,7):\r\n self.eventQueueService.registerBeat() # \u003c= Here I need access to the self property to call the registerBeat function\r\n\r\n # Set pressed pad color to green\r\n print('Pad', pad_ij, 'pressed with velocity', velocity)\r\n push.pads.set_pad_color(pad_ij, 'green')\r\n```\r\n\r\nThanks a lot in advance!","author":{"url":"https://github.com/frederikbrammer","@type":"Person","name":"frederikbrammer"},"datePublished":"2023-04-16T20:15:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/8/push2-python/issues/8"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4862dc91-7f7f-2c18-369f-f65310bb50bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DFA:EFFEF:13071AF:182629B:6991122C |
| html-safe-nonce | 9d2b0f812c77ab5278856ca0273d10ae72d40993925d1db6bdd32690ed931a03 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REZBOkVGRkVGOjEzMDcxQUY6MTgyNjI5Qjo2OTkxMTIyQyIsInZpc2l0b3JfaWQiOiI0NjY0MDc1OTcxMTQ1NTY4ODEyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e6b565518ab8835f43032964bdcd55e9940113279c70595d0b09bcfff656ee03 |
| hovercard-subject-tag | issue:1670119740 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ffont/push2-python/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/98ea5619f37988abb9d1a9b458ac17c41a5390c9e09cda9bf81844377b0edf6f/ffont/push2-python/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/98ea5619f37988abb9d1a9b458ac17c41a5390c9e09cda9bf81844377b0edf6f/ffont/push2-python/issues/8 |
| og:image:alt | Hey there, I would like to organize everything related to the Ableton Push interaction inside of a class named PushService. However, when the decorated function is called, I need to have access to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | frederikbrammer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/ffont/push2-python git https://github.com/ffont/push2-python.git |
| octolytics-dimension-user_id | 478615 |
| octolytics-dimension-user_login | ffont |
| octolytics-dimension-repository_id | 150730943 |
| octolytics-dimension-repository_nwo | ffont/push2-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 150730943 |
| octolytics-dimension-repository_network_root_nwo | ffont/push2-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 848bc6032dcc93a9a7301dcc3f379a72ba13b96e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width