Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorize the Record/Stop button #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pulsecaster/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def on_activate(self, app):
self.close.connect('clicked', self.on_close)
self.record = self.builder.get_object('record_button')
self.record_id = self.record.connect('clicked', self.on_record)
self.record.get_style_context().add_class("suggested-action")
self.record.set_sensitive(True)
self.main_logo = self.builder.get_object('logo')
self.main_logo.set_from_icon_name('pulsecaster', Gtk.IconSize.DIALOG)
Expand Down Expand Up @@ -334,6 +335,8 @@ def on_record(self, *args):

# FIXME: Dim elements other than the 'record' widget
self.record.set_label(Gtk.STOCK_MEDIA_STOP)
self.record.get_style_context().remove_class("suggested-action")
self.record.get_style_context().add_class("destructive-action")
self.record.disconnect(self.record_id)
self.stop_id = self.record.connect('clicked', self.on_stop)
self.record.show()
Expand All @@ -348,6 +351,8 @@ def on_stop(self, *args):
self.combiner.set_state(Gst.State.NULL)
self.showFileChooser()
self.record.set_label(Gtk.STOCK_MEDIA_RECORD)
self.record.get_style_context().remove_class("destructive-action")
self.record.get_style_context().add_class("suggested-action")
self.record.disconnect(self.stop_id)
self.record_id = self.record.connect('clicked', self.on_record)
self.user_vox.cbox.set_sensitive(True)
Expand Down Expand Up @@ -404,6 +409,8 @@ def showFileChooser(self, *args):
Gtk.STOCK_OK,
Gtk.ResponseType.OK))
self.file_chooser.set_local_only(True)
self.file_chooser.set_transient_for(self.main)
self.file_chooser.set_modal(True)
response = self.file_chooser.run()
if response == Gtk.ResponseType.OK:
self.updateFileSinkPath()
Expand All @@ -425,6 +432,9 @@ def hideFileChooser(self, *args):
erase_message,
Gtk.ResponseType.YES),
message_format=confirm_message)

confirm.set_transient_for(self.file_chooser)
confirm.set_modal(True)
response = confirm.run()
confirm.destroy()
if response == Gtk.ResponseType.YES:
Expand Down