mirror of
https://github.com/naruxde/revpicommander.git
synced 2025-11-08 16:43:53 +01:00
Show just the hostname without .local in avahisearch.py list
This commit is contained in:
@@ -229,16 +229,17 @@ class AvahiSearch(QtWidgets.QDialog, Ui_diag_search):
|
|||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def on_act_copy_host_triggered(self) -> None:
|
def on_act_copy_host_triggered(self) -> None:
|
||||||
"""Copy ip address of selected item to clipboard."""
|
"""Copy hostname of selected item to clipboard."""
|
||||||
selected_items = self.tb_revpi.selectedItems()
|
selected_items = self.tb_revpi.selectedItems()
|
||||||
if not selected_items:
|
if not selected_items:
|
||||||
return
|
return
|
||||||
item = selected_items[0]
|
item = selected_items[0]
|
||||||
host_name = item.data(WidgetData.host_name)
|
|
||||||
if platform == "win32":
|
# Use just the hostname on Windows systems, it can not resolve .local addresses
|
||||||
# Strip hostname on Windows systems, it can not resolve .local addresses
|
self.clipboard.setText(
|
||||||
host_name = host_name[:host_name.find(".")]
|
item.data(WidgetData.host_name) if platform == "win32"
|
||||||
self.clipboard.setText(host_name)
|
else item.data(WidgetData.host_name_full)
|
||||||
|
)
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def on_act_copy_ip_triggered(self) -> None:
|
def on_act_copy_ip_triggered(self) -> None:
|
||||||
@@ -256,21 +257,22 @@ class AvahiSearch(QtWidgets.QDialog, Ui_diag_search):
|
|||||||
if not selected_items:
|
if not selected_items:
|
||||||
return
|
return
|
||||||
item = selected_items[0]
|
item = selected_items[0]
|
||||||
if platform == "win32":
|
|
||||||
webbrowser.open("http://{0}/".format(item.data(WidgetData.address)))
|
# Till we could not choose https / http we are using the ip address
|
||||||
else:
|
webbrowser.open("http://{0}/".format(item.data(WidgetData.address)))
|
||||||
webbrowser.open("http://{0}/".format(item.data(WidgetData.host_name)))
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot(str, str, int, str, str)
|
@QtCore.pyqtSlot(str, str, int, str, str)
|
||||||
def on_avahi_added(self, avahi_id: str, server: str, port: int, conf_type: str, ip: str) -> None:
|
def on_avahi_added(self, avahi_id: str, server: str, port: int, conf_type: str, ip: str) -> None:
|
||||||
"""New Revolution Pi found."""
|
"""New Revolution Pi found."""
|
||||||
|
|
||||||
def update_tb_revpi_row(row_index: int):
|
def update_tb_revpi_row(row_index: int):
|
||||||
host_name = server[:-1]
|
host_name_full = server[:-1]
|
||||||
|
host_name = host_name_full[:host_name_full.find(".")]
|
||||||
|
|
||||||
item_name = self.tb_revpi.item(row_index, 0)
|
item_name = self.tb_revpi.item(row_index, 0)
|
||||||
item_name.setData(WidgetData.address, ip)
|
item_name.setData(WidgetData.address, ip)
|
||||||
item_name.setData(WidgetData.port, port)
|
item_name.setData(WidgetData.port, port)
|
||||||
|
item_name.setData(WidgetData.host_name_full, host_name_full)
|
||||||
item_name.setData(WidgetData.host_name, host_name)
|
item_name.setData(WidgetData.host_name, host_name)
|
||||||
|
|
||||||
revpi_settings = item_name.data(WidgetData.revpi_settings) # type: RevPiSettings
|
revpi_settings = item_name.data(WidgetData.revpi_settings) # type: RevPiSettings
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class WidgetData(IntEnum):
|
|||||||
port = 264
|
port = 264
|
||||||
object_name = 265
|
object_name = 265
|
||||||
host_name = 267
|
host_name = 267
|
||||||
|
host_name_full = 268
|
||||||
file_name = 309
|
file_name = 309
|
||||||
revpi_settings = 320
|
revpi_settings = 320
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user