Skip to content

Commit

Permalink
Merge branch 'main' into fix/avoid-type-exception
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux authored Nov 6, 2024
2 parents b9b72ea + db8ce3e commit ae5b3bd
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions qtribu/gui/dck_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ def on_uncompliant_message_received(self, message: QChatUncompliantMessage) -> N
),
application=self.tr("QChat"),
log_level=Qgis.Critical,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
)

def on_text_message_received(self, message: QChatTextMessage) -> None:
Expand Down Expand Up @@ -469,10 +469,8 @@ def on_text_message_received(self, message: QChatTextMessage) -> None:
).format(sender=message.author, message=message.text),
application=self.tr("QChat"),
log_level=Qgis.Info,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager()
.get_plg_settings()
.notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
)

# check if a notification sound should be played
Expand Down Expand Up @@ -540,8 +538,8 @@ def on_like_message_received(self, message: QChatLikeMessage) -> None:
),
application=self.tr("QChat"),
log_level=Qgis.Success,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
)
# play a notification sound if enabled
if self.settings.qchat_play_sounds:
Expand Down Expand Up @@ -696,8 +694,8 @@ def on_send_button_clicked(self) -> None:
self.log(
message=self.tr("Nickname not set : please open settings and set it"),
log_level=Qgis.Warning,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
button=True,
button_label=self.tr("Open Settings"),
button_connect=self.on_settings_button_clicked,
Expand All @@ -710,8 +708,8 @@ def on_send_button_clicked(self) -> None:
"Nickname too short : must be at least 3 characters. Please open settings and set it"
),
log_level=Qgis.Warning,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
button=True,
button_label=self.tr("Open Settings"),
button_connect=self.on_settings_button_clicked,
Expand Down Expand Up @@ -807,8 +805,8 @@ def check_cheatcode(self, text: str) -> bool:
message=self.tr("Your QGIS Pro license is about to expire"),
application=self.tr("QGIS Pro"),
log_level=Qgis.Warning,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
button=True,
button_label=self.tr("Click here to renew it"),
button_connect=self.on_renew_clicked,
Expand Down Expand Up @@ -859,8 +857,8 @@ def on_send_layer_to_qchat(self) -> None:
),
application=self.tr("QChat"),
log_level=Qgis.Critical,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
)
return
layer = self.iface.activeLayer()
Expand All @@ -869,17 +867,17 @@ def on_send_layer_to_qchat(self) -> None:
message=self.tr("No active layer in current QGIS project"),
application=self.tr("QChat"),
log_level=Qgis.Critical,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
)
return
if layer.type() != QgsMapLayer.VectorLayer:
self.log(
message=self.tr("Only vector layers can be sent on QChat"),
application=self.tr("QChat"),
log_level=Qgis.Critical,
push=PlgOptionsManager().get_plg_settings().notify_push_info,
duration=PlgOptionsManager().get_plg_settings().notify_push_duration,
push=self.settings.notify_push_info,
duration=self.settings.notify_push_duration,
)
return

Expand Down

0 comments on commit ae5b3bd

Please sign in to comment.