Commit 1dfbed51 authored by Tijmen de Mes's avatar Tijmen de Mes

Syntax fixes

parent aeffdf92
......@@ -227,7 +227,7 @@ class ChatContentStringAttribute(object):
class ChatContent(object, metaclass=ABCMeta):
__cssclasses__ = ()
continuation_interval = timedelta(0, 5*60) # 5 minutes
continuation_interval = timedelta(0, 5 * 60) # 5 minutes
history = ChatContentBooleanOption('history')
focus = ChatContentBooleanOption('focus')
......@@ -741,7 +741,7 @@ class ChatWidget(base_class, ui_class):
notification_center = NotificationCenter()
timestamp = timestamp if timestamp is not None else ISOTimestamp.now()
notification_center.post_notification('ChatStreamWillSendMessage', blink_session, data=BlinkMessage(content, content_type, blink_session.account , recipients, timestamp=timestamp, id=message_id))
notification_center.post_notification('ChatStreamWillSendMessage', blink_session, data=BlinkMessage(content, content_type, blink_session.account, recipients, timestamp=timestamp, id=message_id))
return message_id
def _align_chat(self, scroll=False):
......@@ -751,7 +751,7 @@ class ChatWidget(base_class, ui_class):
# print widget_height, frame_height, content_height
if widget_height > content_height:
self.chat_element.setStyleProperty('position', 'relative')
self.chat_element.setStyleProperty('top', '%dpx' % (widget_height-content_height))
self.chat_element.setStyleProperty('top', '%dpx' % (widget_height - content_height))
else:
self.chat_element.setStyleProperty('position', 'static')
self.chat_element.setStyleProperty('top', None)
......@@ -2048,7 +2048,7 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
def closeEvent(self, event):
QSettings().setValue("chat_window/geometry", self.saveGeometry())
super(ChatWindow, self).closeEvent(event)
def eventFilter(self, watched, event):
event_type = event.type()
if watched is self.session_widget:
......@@ -2620,8 +2620,8 @@ class ChatWindow(base_class, ui_class, ColorHelperMixin):
incoming_traffic = TrafficNormalizer.normalize(self.incoming_traffic_graph.last_value)
outgoing_traffic = TrafficNormalizer.normalize(self.outgoing_traffic_graph.last_value)
else:
incoming_traffic = TrafficNormalizer.normalize(self.incoming_traffic_graph.last_value*8, bits_per_second=True)
outgoing_traffic = TrafficNormalizer.normalize(self.outgoing_traffic_graph.last_value*8, bits_per_second=True)
incoming_traffic = TrafficNormalizer.normalize(self.incoming_traffic_graph.last_value * 8, bits_per_second=True)
outgoing_traffic = TrafficNormalizer.normalize(self.outgoing_traffic_graph.last_value * 8, bits_per_second=True)
self.traffic_label.setText("""<p>Traffic: <span style="font-family: sans-serif; color: #d70000;">\u2193</span> %s <span style="font-family: sans-serif; color: #0064d7;">\u2191</span> %s</p>""" % (incoming_traffic, outgoing_traffic))
def _SH_MuteButtonClicked(self, checked):
......
......@@ -111,7 +111,7 @@ class HistoryManager(object, metaclass=Singleton):
def _NH_ChatStreamGotMessage(self, notification):
message = notification.data.message
if notification.sender.blink_session.remote_focus and self.sip_prefix_re.sub('',str(message.sender.uri)) not in notification.sender.blink_session.server_conference.participants:
if notification.sender.blink_session.remote_focus and self.sip_prefix_re.sub('', str(message.sender.uri)) not in notification.sender.blink_session.server_conference.participants:
return
is_status_message = any(h.name == 'Message-Type' and h.value == 'status' and h.namespace == 'urn:ag-projects:xml:ns:cpim' for h in message.additional_headers)
......@@ -186,6 +186,7 @@ class Message(SQLObject):
id_idx = DatabaseIndex('message_id')
unq_idx = DatabaseIndex(message_id, account_id, remote_uri, unique=True)
class TableVersions(object, metaclass=Singleton):
__version__ = 1
__versions__ = {}
......@@ -242,7 +243,7 @@ class MessageHistory(object, metaclass=Singleton):
phone_number_re = re.compile(r'^(?P<number>(0|00|\+)[1-9]\d{7,14})@')
def __init__(self):
db_file = ApplicationData.get('message_history.db')
db_file = ApplicationData.get('message_history.db')
db_uri = f'sqlite://{db_file}'
self._initialize(db_uri)
......
......@@ -231,7 +231,7 @@ class MainWindow(base_class, ui_class):
search_box.initStyleOption(option)
frame_width = search_box.style().pixelMetric(QStyle.PM_DefaultFrameWidth, option, search_box)
if frame_width < 4:
search_box.setMinimumHeight(20 + 2*frame_width)
search_box.setMinimumHeight(20 + 2 * frame_width)
# adjust the combo boxes for themes with too much padding (like the default theme on Ubuntu 10.04)
option = QStyleOptionComboBox()
......@@ -694,7 +694,7 @@ class MainWindow(base_class, ui_class):
def _SH_SearchListSelectionChanged(self, selected, deselected):
account_manager = AccountManager()
selected_items = self.search_list.selectionModel().selectedIndexes()
self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)<=1)
self.enable_call_buttons(account_manager.default_account is not None and len(selected_items) <= 1)
def _SH_ServerToolsAccountModelChanged(self, parent_index, start, end):
server_tools_enabled = self.server_tools_account_model.rowCount() > 0
......@@ -949,5 +949,5 @@ class MainWindow(base_class, ui_class):
def _NH_BlinkFileTransferNewOutgoing(self, notification):
self.filetransfer_window.show(activate=QApplication.activeWindow() is not None)
del ui_class, base_class
del ui_class, base_class
......@@ -33,8 +33,8 @@ class BlinkMessage(MSRPChatMessage):
@implementer(IObserver)
class OutgoingMessage(object):
__ignored_content_types__ = {IsComposingDocument.content_type, IMDNDocument.content_type} #Content types to ignore in notifications
__disabled_imdn_content_types__ = {'text/pgp-public-key', 'text/pgp-private-key'}.union(__ignored_content_types__) #Content types to ignore in notifications
__ignored_content_types__ = {IsComposingDocument.content_type, IMDNDocument.content_type} # Content types to ignore in notifications
__disabled_imdn_content_types__ = {'text/pgp-public-key', 'text/pgp-private-key'}.union(__ignored_content_types__) # Content types to ignore in notifications
def __init__(self, account, contact, content, content_type='text/plain', recipients=None, courtesy_recipients=None, subject=None, timestamp=None, required=None, additional_headers=None, id=None):
self.lookup = None
......@@ -249,7 +249,6 @@ class MessageManager(object, metaclass=Singleton):
notification_center.post_notification('BlinkGotDispositionNotification', sender=blink_session, data=NotificationData(id=imdn_message_id, status=imdn_status))
return
message = BlinkMessage(body, content_type, sender, timestamp=timestamp, id=message_id, disposition=disposition)
notification_center.post_notification('BlinkMessageIsParsed', sender=blink_session, data=message)
......@@ -272,7 +271,7 @@ class MessageManager(object, metaclass=Singleton):
content = IsComposingDocument.create(state=State(state),
refresh=Refresh(refresh) if refresh is not None else None,
last_active=LastActive(last_active) if last_active is not None else None,
last_active=LastActive(last_active) if last_active is not None else None,
content_type=ContentType('text'))
self.send_message(session.account, session.contact, content, IsComposingDocument.content_type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment