Hi,
I was wondering if it is possible to make it so that I can have my own notifications pop up after specific things are completed within my script?Notifications being like the ones that pop up in the process of a plate solve, such as "Snapshot captured to...", "Solving frame... Please wait...", "Plate solve succeeded, currently pointing at [coordinates]" et cetera.
Cheers,
RL
Creating custom notifications?
- admin
- Site Admin
- Posts: 13483
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Creating custom notifications?
Hi,
yes, you can do that
You also have 'OK' and 'Warning' as possible status levels, giving you the orange/green/yellow notifications.
cheers,
Robin
yes, you can do that
Code: Select all
from SharpCap.Base import NotificationStatus
SharpCap.ShowNotification("Hello", NotificationStatus.Error)
cheers,
Robin
Re: Creating custom notifications?
Hi Robin,
I see, thank you!
Is it also possible to create some kind of custom button that can terminate the running script? Mainly asking because ideally, for a script I'm working on, a user can run the script without having to open the console (and possibly be intimidated by the interface if they don't have much experience with programming).
Cheers,
RL
I see, thank you!
Is it also possible to create some kind of custom button that can terminate the running script? Mainly asking because ideally, for a script I'm working on, a user can run the script without having to open the console (and possibly be intimidated by the interface if they don't have much experience with programming).
Cheers,
RL
- admin
- Site Admin
- Posts: 13483
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Creating custom notifications?
Hi,
yes, you can do that
'help(...)' is your friend by the way...
The only thing it doesn't tell you is exactly where to import types from , but SharpCap.Base or SharpCap.Interfaces are usually a good bet.
cheers,
Robin
yes, you can do that
Code: Select all
# IronPython Pad. Write code snippets here and F5 to run. If code is selected, only selection is run.
from SharpCap.Base import NotificationButton
from SharpCap.Base import NotificationStatus
def Test():
print ("hello")
b = NotificationButton("Test Button", Test)
SharpCap.ShowNotification("Press the button", NotificationStatus.OK, False, 30, None, b)
Code: Select all
help (SharpCap.ShowNotification)
Help on built-in function ShowNotification:
ShowNotification(...) method of builtins.Application instance
ShowNotification(self: Application, notificationMessage: NotificationMessage)ShowNotification(self: Application, messageText: str, status: NotificationStatus, showCloseBox: bool, visibleForSeconds: Int32, closedCallback: Action, button1: NotificationButton, button2: NotificationButton)
Code: Select all
help (NotificationButton)
Help on class NotificationButton in module builtins:
class NotificationButton(object)
| NotificationButton(buttonText: str, buttonPress: Action)
|
| Methods defined here:
|
| __new__(...)
| __new__(cls: type, buttonText: str, buttonPress: Action)
|
| __repr__(...)
| __repr__(self: object) -> str
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| ButtonPress
| Get: ButtonPress(self: NotificationButton) -> Action
|
| ButtonText
| Get: ButtonText(self: NotificationButton) -> str
cheers,
Robin