Skip to content

Commit 183be94

Browse files
committed
Replace python super with objc super for NSObjects
1 parent 348511f commit 183be94

37 files changed

+101
-91
lines changed

AccountSettings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def createWithOwner_(cls, owner):
4545
return w
4646

4747
def initWithOwner_(self, owner):
48-
self = super(AccountSettings, self).init()
48+
self = objc.super(AccountSettings, self).init()
4949
if self:
5050
self.owner = owner
5151
NSBundle.loadNibNamed_owner_("AccountSettings", self)

AudioSession.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def sessionControllersManager(self):
5656
return NSApp.delegate().contactsWindowController.sessionControllersManager
5757

5858
def dealloc(self):
59-
super(AudioSession, self).dealloc()
59+
objc.super(AudioSession, self).dealloc()
6060

6161
def acceptsFirstResponder(self):
6262
return True

BlinkAppDelegate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class BlinkAppDelegate(NSObject):
142142
terminating = False
143143

144144
def init(self):
145-
self = super(BlinkAppDelegate, self).init()
145+
self = objc.super(BlinkAppDelegate, self).init()
146146
if self:
147147
self.applicationName = str(NSBundle.mainBundle().infoDictionary().objectForKey_("CFBundleExecutable"))
148148
self.applicationNamePrint = str(NSBundle.mainBundle().infoDictionary().objectForKey_("CFBundleName"))

ChatController.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ class OutgoingMessageHandler(NSObject):
18241824
OTRNegotiationTimer = None
18251825

18261826
def initWithView_(self, chatView):
1827-
self = super(OutgoingMessageHandler, self).init()
1827+
self = objc.super(OutgoingMessageHandler, self).init()
18281828
if self:
18291829
self.stream = None
18301830
self.connected = None
@@ -1838,7 +1838,7 @@ def initWithView_(self, chatView):
18381838

18391839
def dealloc(self):
18401840
self.delegate = None
1841-
super(OutgoingMessageHandler, self).dealloc()
1841+
objc.super(OutgoingMessageHandler, self).dealloc()
18421842

18431843
def close(self):
18441844
self.stream = None

ChatPrivateMessageController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,5 @@ def cancelClicked_(self, sender):
8989
NSApp.stopModalWithCode_(NSCancelButton)
9090

9191
def dealloc(self):
92-
super(ChatPrivateMessageController, self).dealloc()
92+
objc.super(ChatPrivateMessageController, self).dealloc()
9393

ChatViewController.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ChatInputTextView(NSTextView):
8484
maxLength = None
8585

8686
def dealloc(self):
87-
super(ChatInputTextView, self).dealloc()
87+
objc.super(ChatInputTextView, self).dealloc()
8888

8989
def initWithRect_(self, rect):
9090
self = NSTextView.initWithRect_(self, rect)
@@ -156,12 +156,12 @@ def keyDown_(self, event):
156156
if keys[0] == 'i' and self.owner.delegate.sessionController.info_panel is not None:
157157
self.owner.delegate.sessionController.info_panel.toggle()
158158
else:
159-
super(ChatInputTextView, self).keyDown_(event)
159+
objc.super(ChatInputTextView, self).keyDown_(event)
160160

161161

162162
class ChatWebView(WebView):
163163
def dealloc(self):
164-
super(ChatWebView, self).dealloc()
164+
objc.super(ChatWebView, self).dealloc()
165165

166166
def draggingEntered_(self, sender):
167167
pboard = sender.draggingPasteboard()
@@ -681,7 +681,7 @@ def dealloc(self):
681681
self.scrollingTimer.invalidate()
682682
self.scrollingTimer = None
683683
NSNotificationCenter.defaultCenter().removeObserver_(self)
684-
super(ChatViewController, self).dealloc()
684+
objc.super(ChatViewController, self).dealloc()
685685

686686

687687
class Transform(object):

ChatWindowController.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class ChatWindowController(NSWindowController):
161161
contact_timer = None
162162

163163
def init(self):
164-
self = super(ChatWindowController, self).init()
164+
self = objc.super(ChatWindowController, self).init()
165165
if self:
166166
BlinkLogger().log_debug('Starting Chat Window Controller')
167167
smileys = SmileyManager()
@@ -668,7 +668,7 @@ def keyDown_(self, event):
668668
if keys[0] == 'i' and session and session.info_panel is not None:
669669
session.info_panel.toggle()
670670
else:
671-
super(ChatWindowController, self).keyDown_(event)
671+
objc.super(ChatWindowController, self).keyDown_(event)
672672

673673
def close_(self, sender):
674674
chat_sessions = len([s for s in self.sessions.values() if s.hasStreamOfType("chat")])

ConferenceController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def dealloc(self):
145145
self.notification_center.remove_observer(self, name='BonjourConferenceServicesDidUpdateServer')
146146
self.notification_center.remove_observer(self, name='BonjourConferenceServicesDidAddServer')
147147
self.notification_center.remove_observer(self, name='SIPAccountManagerDidChangeDefaultAccount')
148-
super(JoinConferenceWindowController, self).dealloc()
148+
objc.super(JoinConferenceWindowController, self).dealloc()
149149

150150
@allocate_autorelease_pool
151151
@run_in_gui_thread

ConferenceFileCell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
NSMakeSize,
1212
NSTextFieldCell)
1313

14+
import objc
1415

1516
class ConferenceFileCell(NSTextFieldCell):
1617
conference_file = None
@@ -35,13 +36,13 @@ def drawingRectForBounds_(self, rect):
3536

3637
def cellSize(self):
3738
if self.conference_file is None:
38-
return super(ConferenceFileCell, self).cellSize()
39+
return objc.super(ConferenceFileCell, self).cellSize()
3940
return NSMakeSize(100, 30)
4041

4142
def drawWithFrame_inView_(self, frame, view):
4243
if self.conference_file is None:
4344
tmp = frame
44-
return super(ConferenceFileCell, self).drawWithFrame_inView_(tmp, view)
45+
return objc.super(ConferenceFileCell, self).drawWithFrame_inView_(tmp, view)
4546

4647
self.drawIcon(self.conference_file.icon, 2, frame.origin.y+3, 28, 28)
4748

ConferenceScreenSharing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def createWithOwner_(cls, owner):
4848
return w
4949

5050
def initWithOwner_(self, owner):
51-
self = super(ConferenceScreenSharing, self).init()
51+
self = objc.super(ConferenceScreenSharing, self).init()
5252
if self:
5353
self.owner = owner
5454
NSBundle.loadNibNamed_owner_("ConferenceScreenSharing", self)

ContactCell.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
NSTextFieldCell)
2020

2121
import datetime
22+
import objc
2223

2324
from sipsimple.configuration.settings import SIPSimpleSettings
2425
from sipsimple.account import BonjourAccount
@@ -57,13 +58,13 @@ def drawingRectForBounds_(self, rect):
5758

5859
def cellSize(self):
5960
if self.contact is None:
60-
return super(ContactCell, self).cellSize()
61+
return objc.super(ContactCell, self).cellSize()
6162
return NSMakeSize(100, 30)
6263

6364
@allocate_autorelease_pool
6465
def drawWithFrame_inView_(self, frame, view):
6566
if self.contact is None:
66-
return super(ContactCell, self).drawWithFrame_inView_(frame, view)
67+
return objc.super(ContactCell, self).drawWithFrame_inView_(frame, view)
6768

6869
self.frame = frame
6970
self.view = view

ContactController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
class MyImageThing(NSImageView):
4545
def mouseDown_(self, event):
46-
super(MyImageThing, self).mouseDown_(event)
46+
objc.super(MyImageThing, self).mouseDown_(event)
4747
self.target().performSelector_withObject_(self.action(), self)
4848

4949

ContactListModel.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def preferred_media(self):
403403

404404
def dealloc(self):
405405
self.avatar = None
406-
super(BlinkContact, self).dealloc()
406+
objc.super(BlinkContact, self).dealloc()
407407

408408
def destroy(self):
409409
# workaround to keep the object alive as cocoa still sends delegate outline view messages to deallocated contacts
@@ -513,7 +513,7 @@ class BlinkConferenceContact(BlinkContact):
513513
implements(IObserver)
514514

515515
def __init__(self, uri, name=None, icon=None, presence_contact=None):
516-
super(BlinkConferenceContact, self).__init__(uri, name=name, icon=icon)
516+
objc.super(BlinkConferenceContact, self).__init__(uri, name=name, icon=icon)
517517
self.active_media = []
518518
self.screensharing_url = None
519519
self.presence_contact = presence_contact
@@ -535,7 +535,7 @@ def destroy(self):
535535
if self.presence_contact is not None:
536536
NotificationCenter().remove_observer(self, name="BlinkContactPresenceHasChanged", sender=self.presence_contact)
537537
self.presence_contact = None
538-
super(BlinkConferenceContact, self).destroy()
538+
objc.super(BlinkConferenceContact, self).destroy()
539539

540540
@run_in_gui_thread
541541
def handle_notification(self, notification):
@@ -637,7 +637,7 @@ def __init__(self, account):
637637

638638
name = account.display_name or uri
639639

640-
super(BlinkMyselfConferenceContact, self).__init__(uri, name=name, icon=own_icon)
640+
objc.super(BlinkMyselfConferenceContact, self).__init__(uri, name=name, icon=own_icon)
641641
self.active_media = []
642642
self.screensharing_url = None
643643
self.presence_note = None
@@ -650,7 +650,7 @@ class BlinkPendingWatcher(BlinkContact):
650650

651651
def __init__(self, watcher):
652652
uri = sip_prefix_pattern.sub('', watcher.sipuri)
653-
super(BlinkPendingWatcher, self).__init__(uri, name=watcher.display_name)
653+
objc.super(BlinkPendingWatcher, self).__init__(uri, name=watcher.display_name)
654654
self.avatar = PendingWatcherAvatar()
655655

656656

@@ -663,12 +663,12 @@ def __init__(self, policy):
663663
self.policy = policy
664664
uri = policy.uri
665665
name = policy.name
666-
super(BlinkBlockedPresenceContact, self).__init__(uri, name=name)
666+
objc.super(BlinkBlockedPresenceContact, self).__init__(uri, name=name)
667667
self.avatar = BlockedPolicyAvatar()
668668

669669
def destroy(self):
670670
self.policy = None
671-
super(BlinkBlockedPresenceContact, self).destroy()
671+
objc.super(BlinkBlockedPresenceContact, self).destroy()
672672

673673

674674
class BlinkPresenceContactAttribute(object):
@@ -797,7 +797,7 @@ def destroy(self):
797797
self.timer.invalidate()
798798
self.timer = None
799799
self.pidfs_map = {}
800-
super(BlinkPresenceContact, self).destroy()
800+
objc.super(BlinkPresenceContact, self).destroy()
801801

802802
@allocate_autorelease_pool
803803
@run_in_gui_thread
@@ -1551,7 +1551,7 @@ def matchesURI(self, uri, exact_match=False):
15511551

15521552
def destroy(self):
15531553
self.bonjour_neighbour = None
1554-
super(BonjourBlinkContact, self).destroy()
1554+
objc.super(BonjourBlinkContact, self).destroy()
15551555

15561556

15571557
class SearchResultContact(BlinkContact):
@@ -1760,7 +1760,7 @@ class BonjourBlinkGroup(VirtualBlinkGroup):
17601760
delete_contact_allowed = False
17611761

17621762
def __init__(self, name=NSLocalizedString("Bonjour Neighbours", "Group name label"), expanded=True):
1763-
super(BonjourBlinkGroup, self).__init__(name, expanded)
1763+
objc.super(BonjourBlinkGroup, self).__init__(name, expanded)
17641764
self.not_filtered_contacts = [] # keep a list of all neighbors so that we can rebuild the contacts when the sip transport changes, by default TLS transport is preferred
17651765
self.original_position = None
17661766

@@ -1775,7 +1775,7 @@ class NoBlinkGroup(VirtualBlinkGroup):
17751775
delete_contact_allowed = True
17761776

17771777
def __init__(self, name=NSLocalizedString("No Group", "Group name label"), expanded=False):
1778-
super(NoBlinkGroup, self).__init__(name, expanded)
1778+
objc.super(NoBlinkGroup, self).__init__(name, expanded)
17791779

17801780

17811781
class PendingWatchersGroup(VirtualBlinkGroup):
@@ -1788,7 +1788,7 @@ class PendingWatchersGroup(VirtualBlinkGroup):
17881788
delete_contact_allowed = False
17891789

17901790
def __init__(self, name=NSLocalizedString("New Contact Requests", "Group name label"), expanded=True):
1791-
super(PendingWatchersGroup, self).__init__(name, expanded)
1791+
objc.super(PendingWatchersGroup, self).__init__(name, expanded)
17921792

17931793

17941794
class BlockedGroup(VirtualBlinkGroup):
@@ -1801,7 +1801,7 @@ class BlockedGroup(VirtualBlinkGroup):
18011801
delete_contact_allowed = False
18021802

18031803
def __init__(self, name=NSLocalizedString("Blocked Contacts", "Group name label"), expanded=False):
1804-
super(BlockedGroup, self).__init__(name, expanded)
1804+
objc.super(BlockedGroup, self).__init__(name, expanded)
18051805

18061806

18071807
class OnlineGroup(VirtualBlinkGroup):
@@ -1814,7 +1814,7 @@ class OnlineGroup(VirtualBlinkGroup):
18141814
delete_contact_allowed = True
18151815

18161816
def __init__(self, name=NSLocalizedString("Online Contacts", "Group name label"), expanded=True):
1817-
super(OnlineGroup, self).__init__(name, expanded)
1817+
objc.super(OnlineGroup, self).__init__(name, expanded)
18181818

18191819

18201820
class AllContactsBlinkGroup(VirtualBlinkGroup):
@@ -1828,7 +1828,7 @@ class AllContactsBlinkGroup(VirtualBlinkGroup):
18281828
delete_contact_allowed = True
18291829

18301830
def __init__(self, name=NSLocalizedString("All Contacts", "Group name label"), expanded=True):
1831-
super(AllContactsBlinkGroup, self).__init__(name, expanded)
1831+
objc.super(AllContactsBlinkGroup, self).__init__(name, expanded)
18321832

18331833

18341834
class HistoryBlinkGroup(VirtualBlinkGroup):
@@ -1844,7 +1844,7 @@ class HistoryBlinkGroup(VirtualBlinkGroup):
18441844
last_results = []
18451845

18461846
def __init__(self, name, expanded=False):
1847-
super(HistoryBlinkGroup, self).__init__(name, expanded)
1847+
objc.super(HistoryBlinkGroup, self).__init__(name, expanded)
18481848
# contacts are not yet loaded when building this group so we cannot lookup contacts just yet
18491849
self.timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(6.0, self, "firstLoadTimer:", None, False)
18501850
NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSRunLoopCommonModes)
@@ -1998,7 +1998,7 @@ class MissedCallsBlinkGroup(HistoryBlinkGroup):
19981998
type = 'missed'
19991999

20002000
def __init__(self, name=NSLocalizedString("Missed Calls", "Group name label")):
2001-
super(MissedCallsBlinkGroup, self).__init__(name, expanded=True)
2001+
objc.super(MissedCallsBlinkGroup, self).__init__(name, expanded=True)
20022002

20032003
def get_history_entries(self):
20042004
return SessionHistory().get_entries(hidden=0, after_date=self.after_date, count=200)
@@ -2008,7 +2008,7 @@ class OutgoingCallsBlinkGroup(HistoryBlinkGroup):
20082008
type = 'outgoing'
20092009

20102010
def __init__(self, name=NSLocalizedString("Outgoing Calls", "Group name label")):
2011-
super(OutgoingCallsBlinkGroup, self).__init__(name, expanded=True)
2011+
objc.super(OutgoingCallsBlinkGroup, self).__init__(name, expanded=True)
20122012

20132013
def get_history_entries(self):
20142014
return SessionHistory().get_entries(direction='outgoing', remote_focus="0", hidden=0, after_date=self.after_date, count=100)
@@ -2018,7 +2018,7 @@ class IncomingCallsBlinkGroup(HistoryBlinkGroup):
20182018
type = 'incoming'
20192019

20202020
def __init__(self, name=NSLocalizedString("Incoming Calls", "Group name label")):
2021-
super(IncomingCallsBlinkGroup, self).__init__(name, expanded=True)
2021+
objc.super(IncomingCallsBlinkGroup, self).__init__(name, expanded=True)
20222022

20232023
def get_history_entries(self):
20242024
return SessionHistory().get_entries(direction='incoming', status='completed', remote_focus="0", hidden=0, after_date=self.after_date, count=100)
@@ -2035,7 +2035,7 @@ class VoicemailBlinkGroup(VirtualBlinkGroup):
20352035
original_position = None
20362036

20372037
def __init__(self, name=NSLocalizedString("Voicemail", "Group name label")):
2038-
super(VoicemailBlinkGroup, self).__init__(name, expanded=True)
2038+
objc.super(VoicemailBlinkGroup, self).__init__(name, expanded=True)
20392039

20402040
@property
20412041
def groupsList(self):
@@ -2112,7 +2112,7 @@ class AddressBookBlinkGroup(VirtualBlinkGroup):
21122112
delete_contact_allowed = False
21132113

21142114
def __init__(self, name=NSLocalizedString("Address Book", "Group name label")):
2115-
super(AddressBookBlinkGroup, self).__init__(name, expanded=False)
2115+
objc.super(AddressBookBlinkGroup, self).__init__(name, expanded=False)
21162116

21172117
@run_in_thread('addressbook')
21182118
@allocate_autorelease_pool

ContactWindowController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def showWindow_(self, sender):
730730
self.window().setTitle_(NSApp.delegate().main_window_title)
731731
else:
732732
self.window().setTitle_(NSApp.delegate().applicationNamePrint)
733-
super(ContactWindowController, self).showWindow_(sender)
733+
objc.super(ContactWindowController, self).showWindow_(sender)
734734

735735
def copyToSearchBar_(self, sender):
736736
self.searchBox.setStringValue_(sender.representedObject())

DebugWindow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class DebugWindow(NSObject):
135135
sendingText = NSAttributedString.alloc().initWithString_attributes_("SENDING:", NSDictionary.dictionaryWithObject_forKey_(NSColor.orangeColor(), NSForegroundColorAttributeName))
136136

137137
def init(self):
138-
self = super(DebugWindow, self).init()
138+
self = objc.super(DebugWindow, self).init()
139139

140140
NSBundle.loadNibNamed_owner_("DebugWindow", self)
141141

@@ -352,7 +352,7 @@ def dealloc(self):
352352
notification_center.discard_observer(self, name="SIPEngineLog")
353353
notification_center.discard_observer(self)
354354

355-
super(DebugWindow, self).dealloc()
355+
objc.super(DebugWindow, self).dealloc()
356356

357357
def append_line(self, textView, line):
358358
if isinstance(line, NSAttributedString):

EnrollmentController.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def init(self):
9999

100100
def dealloc(self):
101101
NotificationCenter().discard_observer(self, name='SIPAccountManagerDidAddAccount')
102-
super(EnrollmentController, self).dealloc()
102+
objc.super(EnrollmentController, self).dealloc()
103103

104104
def runModal(self):
105105
BlinkLogger().log_info('Starting Enrollment')

0 commit comments

Comments
 (0)