Skip to content

Commit

Permalink
Fix: UI bugs and macOS crash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rahilmansuri1 committed Feb 21, 2025
1 parent 8036221 commit c6e888a
Show file tree
Hide file tree
Showing 36 changed files with 645 additions and 455 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.1
current_version = 0.1.2
commit = False
tag = False
allow_dirty = True
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ build_info.json
settings.json
/appimages/
temp_build_constant.py
.DS_Store
Binary file removed binary/native_auth_windows.exe
Binary file not shown.
3 changes: 0 additions & 3 deletions pylint_logs.txt

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "iris-wallet-desktop"
version = "0.1.1"
version = "0.1.2"
description = ""
readme = "README.md"
license = ""
Expand Down
4 changes: 1 addition & 3 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init_ui__(self):

def resizeEvent(self, event): # pylint:disable=invalid-name
"""Handle window resize and trigger toaster repositioning."""
# ToasterManager.on_resize(event.size())
ToasterManager.reposition_toasters()
super().resizeEvent(event)

Expand All @@ -72,7 +71,7 @@ def closeEvent(self, event): # pylint:disable=invalid-name
cache.invalidate_cache()
wallet_type: WalletType = SettingRepository.get_wallet_type()
if wallet_type.value == WalletType.REMOTE_TYPE_WALLET.value or page_name in excluded_page:
QApplication.instance().quit()
QApplication.instance().exit()
else:
self.show_backup_progress()
# Ignore the close event until the backup is complete
Expand All @@ -95,7 +94,6 @@ def show_backup_progress(self):
backup_configure_dialog_box.exec()
else:
self.progress_dialog.exec(True)
# self.progress_dialog.start_process(True)
self.progress_dialog.exec()


Expand Down
52 changes: 38 additions & 14 deletions src/model/help_card_content_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
from pydantic import BaseModel
from pydantic import HttpUrl

from src.data.repository.setting_repository import SettingRepository
from src.model.enums.enums_model import NetworkEnumModel


class HelpCardModel(BaseModel):
"""Model for a single help card."""
title: str
detail: str
links: list[HttpUrl]
links: list[HttpUrl] | None = None


class HelpCardContentModel(BaseModel):
Expand All @@ -24,24 +27,45 @@ def create_default(cls):
"""Factory method to create a default instance of HelpCardContentModel"""
card_content = [
HelpCardModel(
title='Why can I get TESTNET Bitcoins?',
detail='You can get Testnet Bitcoin by using one of the many available faucets. Below are a few linked examples, but you can always find more using a search engine:',
links=[
'https://testnet-faucet.mempool.co/',
'https://bitcoinfaucet.uo1.net/',
'https://coinfaucet.eu/en/btc-testnet/',
'https://testnet-faucet.com/btc-testnet/',
],
title='Where can I learn more about RGB?',
detail='Visit <a href="https://rgb.info" style="color: #03CA9B; text-decoration: none;">rgb.info</a> for resources and documentation.',
),
HelpCardModel(
title="Why do I see outgoing Bitcoin transactions that I didn't authorize?",
detail='You can get Testnet Bitcoin by using one of the many available faucet, below are few linked examples but you can always find more using a search engine:',
detail='In the RGB protocol assets need to be assigned to a Bitcoin output, if you do not have available UTXOs to receive, issue, or send yourself change assets, the wallet will use the available bitcoin balance to generate new UTXOs. Such transactions are marked in the transaction list as "internal"',
),
HelpCardModel(
title='What is the minimum bitcoin balance needed to issue and receive RGB assets?',
detail='To create a set of UTXOs needed to issue and receive assets the initial bitcoin balance needs to be at least 10,000 satoshis',
),
HelpCardModel(
title='Where can I send feedback or ask for support?',
detail='For support and feedback there is a dedicated Telegram group:',
links=[
'https://testnet-faucet.mempool.co/',
'https://bitcoinfaucet.uo1.net/',
'https://coinfaucet.eu/en/btc-testnet/',
'https://testnet-faucet.com/btc-testnet/',
'https://t.me/IrisWallet',
],
),
]
network = SettingRepository.get_wallet_network()
if network == NetworkEnumModel.REGTEST:
card_content.append(
HelpCardModel(
title='Where can I get REGTEST Bitcoins?',
detail='You can receive Regtest Bitcoin by using our Telegram bot. Click the link below to request funds:',
links=['https://t.me/rgb_lightning_bot'],
),
)
else: # Default to Testnet
card_content.append(
HelpCardModel(
title='Where can I get TESTNET Bitcoins?',
detail='You can get Testnet Bitcoin by using one of the many available faucets. Below are a few linked examples, but you can always find more using a search engine:',
links=[
'https://testnet-faucet.mempool.co/',
'https://bitcoinfaucet.uo1.net/',
'https://coinfaucet.eu/en/btc-testnet/',
'https://testnet-faucet.com/btc-testnet/',
],
),
)
return cls(card_content=card_content)
Binary file modified src/translations/en_IN.qm
Binary file not shown.
16 changes: 14 additions & 2 deletions src/translations/en_IN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1665,8 +1665,20 @@ If you understand the above remarks and wish to proceed, press the button below
<translation>RGB invoice</translation>
</message>
<message>
<source>copied</source>
<translation>Copied!</translation>
<source>copied</source>
<translation>Copied!</translation>
</message>
<message>
<source>local_balance</source>
<translation>Local Balance</translation>
</message>
<message>
<source>remote_balance</source>
<translation>Remote Balance</translation>
</message>
<message>
<source>asset</source>
<translation>Asset</translation>
</message>
<message>
<source>data_directory_path_label</source>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/common_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def sigterm_handler(_sig, _frame):
# Stop the LN node server and quit the application
ln_node_manager = LnNodeServerManager.get_instance()
ln_node_manager.stop_server_from_close_button()
QApplication.instance().quit()
QApplication.instance().exit()


def set_number_validator(input_widget: QLineEdit) -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"""
from __future__ import annotations

__version__ = '0.1.1'
__version__ = '0.1.2'
2 changes: 1 addition & 1 deletion src/viewmodels/enter_password_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def on_error(self, error: CommonException):
if error.message == ERROR_NETWORK_MISMATCH:
local_store.clear_settings()
MessageBox('critical', error.message)
QApplication.instance().quit()
QApplication.instance().exit()
self.message.emit(
ToastPreset.ERROR,
error.message or ERROR_SOMETHING_WENT_WRONG,
Expand Down
49 changes: 24 additions & 25 deletions src/viewmodels/header_frame_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,62 @@

from PySide6.QtCore import QObject
from PySide6.QtCore import QThread
from PySide6.QtCore import QTimer
from PySide6.QtCore import Signal

from src.utils.constant import PING_DNS_ADDRESS_FOR_NETWORK_CHECK
from src.utils.constant import PING_DNS_SERVER_CALL_INTERVAL


class NetworkCheckerThread(QThread):
"""View model to handle network connectivity"""
"""Thread to handle network connectivity checking."""
network_status_signal = Signal(bool)
_instance = None

def __init__(self):
super().__init__()
self.running = True

def run(self):
"""Run the network checking loop."""
while self.running:
is_connected = self.check_internet_conn()
self.network_status_signal.emit(is_connected)
# Wait 5 seconds before the next check
self.msleep(PING_DNS_SERVER_CALL_INTERVAL)
"""Run the network check once."""
is_connected = self.check_internet_conn()
self.network_status_signal.emit(is_connected)

def check_internet_conn(self):
"""Check internet connection by making a request to the specified URL."""
"""Check internet connection and return status."""
try:
# Attempt to resolve the hostname of Google to test internet
socket.create_connection(
(PING_DNS_ADDRESS_FOR_NETWORK_CHECK, 53), timeout=3,
)
return True
except OSError:
return False

def stop(self):
"""Stop the thread."""
self.running = False
self.quit()
self.wait()


class HeaderFrameViewModel(QObject):
"""Handle network connectivity"""
"""Handles network connectivity in the UI."""
network_status_signal = Signal(bool)

def __init__(self):
super().__init__() # Call the parent constructor
super().__init__()

self.network_checker = None

# Use QTimer in the main thread
self.timer = QTimer(self)
self.timer.setInterval(PING_DNS_SERVER_CALL_INTERVAL)
self.timer.timeout.connect(self.start_network_check)

# Start checking
self.timer.start()

def start_network_check(self):
"""Start a new network check using a separate thread."""
self.network_checker = NetworkCheckerThread()
self.network_checker.network_status_signal.connect(
self.handle_network_status,
)
self.network_checker.start()

def handle_network_status(self, is_connected):
"""Handle the network status change."""
"""Emit network status signal."""
self.network_status_signal.emit(is_connected)

def stop_network_checker(self):
"""Stop the network checker when no longer needed."""
self.network_checker.stop()
"""Stop network checking when it's no longer needed."""
self.timer.stop()
3 changes: 3 additions & 0 deletions src/viewmodels/main_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from src.viewmodels.enter_password_view_model import EnterWalletPasswordViewModel
from src.viewmodels.faucets_view_model import FaucetsViewModel
from src.viewmodels.fee_rate_view_model import EstimateFeeViewModel
from src.viewmodels.header_frame_view_model import HeaderFrameViewModel
from src.viewmodels.issue_rgb20_view_model import IssueRGB20ViewModel
from src.viewmodels.issue_rgb25_view_model import IssueRGB25ViewModel
from src.viewmodels.ln_endpoint_view_model import LnEndpointViewModel
Expand Down Expand Up @@ -108,3 +109,5 @@ def __init__(self, page_navigation):
)

self.estimate_fee_view_model = EstimateFeeViewModel()

self.header_frame_view_model = HeaderFrameViewModel()
2 changes: 1 addition & 1 deletion src/viewmodels/set_wallet_password_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def on_error(self, exc: CommonException):
if exc.message == ERROR_NETWORK_MISMATCH:
local_store.clear_settings()
MessageBox('critical', exc.message)
QApplication.instance().quit()
QApplication.instance().exit()
self.message.emit(
ToastPreset.ERROR,
exc.message or 'Something went wrong',
Expand Down
8 changes: 4 additions & 4 deletions src/viewmodels/setting_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def set_bitcoind_host(self, bitcoind_host: str, password: str):
)

def set_bitcoind_port(self, bitcoind_port: int, password: str):
"""Sets the Default bitcoind host."""
"""Sets the Default bitcoind port."""
self.is_loading.emit(True)
try:
self.password = password
Expand All @@ -562,7 +562,7 @@ def set_bitcoind_port(self, bitcoind_port: int, password: str):
)

def set_announce_address(self, announce_address: str, password: str):
"""Sets the Default bitcoind host."""
"""Sets the Default announce address."""
self.is_loading.emit(True)

try:
Expand All @@ -581,7 +581,7 @@ def set_announce_address(self, announce_address: str, password: str):
)

def set_announce_alias(self, announce_alias: str, password: str):
"""Sets the Default bitcoind host."""
"""Sets the Default announce alias."""
self.is_loading.emit(True)
try:
self.password = password
Expand All @@ -599,7 +599,7 @@ def set_announce_alias(self, announce_alias: str, password: str):
)

def set_min_confirmation(self, min_confirmation: int):
"""Sets the default fee rate."""
"""Sets the default min confirmation."""
try:
success: IsDefaultMinConfirmationSet = SettingCardRepository.set_default_min_confirmation(
min_confirmation,
Expand Down
4 changes: 2 additions & 2 deletions src/viewmodels/splash_view_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def on_error(self, error: Exception):
error, CommonException,
) else ERROR_SOMETHING_WENT_WRONG
ToastManager.error(description=description)
QApplication.instance().quit()
QApplication.instance().exit()

def is_login_authentication_enabled(self, view_model: WalletTransferSelectionViewModel):
"""Check login authentication enabled"""
Expand Down Expand Up @@ -121,7 +121,7 @@ def on_error_of_unlock_api(self, error: Exception):

if error_message in [ERROR_CONNECTION_FAILED_WITH_LN, ERROR_REQUEST_TIMEOUT]:
MessageBox('critical', message_text=ERROR_CONNECTION_FAILED_WITH_LN)
QApplication.instance().quit()
QApplication.instance().exit()

# Log the error and display a toast message
logger.error(
Expand Down
2 changes: 1 addition & 1 deletion src/viewmodels/wallet_and_transfer_selection_viewmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def on_ln_node_error(self, code: int, error: str):
str(error), str(code),
)
MessageBox('critical', message_text=ERROR_UNABLE_TO_START_NODE)
QApplication.instance().quit()
QApplication.instance().exit()

def on_ln_node_already_running(self):
"""Log and toast when node already running"""
Expand Down
2 changes: 1 addition & 1 deletion src/views/components/keyring_error_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def handle_when_origin_page_set_wallet(self):
else:
local_store.clear_settings()
self.close()
QApplication.instance().quit()
QApplication.instance().exit()
except CommonException as exc:
self.error.emit(exc.message)
ToastManager.error(
Expand Down
Loading

0 comments on commit c6e888a

Please sign in to comment.