#!/usr/bin/perl -w use strict; use warnings; use Glib qw/TRUE FALSE/; use Gtk2 '-init'; #global variables my $interface; my $mapped = 0; my $progressbar_uasposition; my $progressbar_waytemp2; my $progressbar_waytemp1; my $progressbar_wayfinal; my $progressbar_waytemp3; my $progressbar_uas; #shared Variables my $die: shared = 0; my $count_waytemp3 = 0; my $count_uas = 0; my $count_uasposition = 0; my $current_controls = 0; $interface = Gtk2::Window->new('popup'); $interface->set_position('mouse'); $interface->set_border_width( 5); #Eventbox for capturing the mouse click my $eventbox_interface = Gtk2::EventBox->new; #table to contain the widgets my $table_interface = Gtk2::Table->new( 14, 2, FALSE); #spacers for the widgets my $spacer1 = Gtk2::Label->new(); my $spacer2 = Gtk2::Label->new(); my $spacer3 = Gtk2::Label->new(); my $spacer4 = Gtk2::Label->new(); #Labels my $label_downloading = Gtk2::Label->new( 'Downloading'); my $label_uploading = Gtk2::Label->new( 'Uploading'); #Bold text for the Main Labels my $fontdescription = Gtk2::Pango::FontDescription->new; $fontdescription->set_weight( 'bold'); $label_uploading->modify_font( $fontdescription); $label_downloading->modify_font( $fontdescription); #The interface for Nav #text features my $buffer = Gtk2::TextBuffer->new(); #Label my $label_nav_waypoint = Gtk2::Label->new( ); my $label_nav_waytemp = Gtk2::Label->new( 'waytemp'); my $label_nav_uas = Gtk2::Label->new( 'uaspf.txt'); #Markup for the text labels $label_nav_waypoint->set_markup( '<b>Waypoint Generation</b>'); #Create the scrolled window that the lat and long entries will be disp +layed in my $swindow_nav = Gtk2::ScrolledWindow->new( undef, undef); $swindow_nav->set_policy( 'automatic', 'automatic'); $swindow_nav->set_shadow_type( 'etched-out'); my $textview_nav = Gtk2::TextView->new; $swindow_nav->add( $textview_nav); #Buttons to compile the waypoint files my $button_nav_waypoint = Gtk2::Button->new( 'Compile/Send'); my $button_nav_connect = Gtk2::Button->new( 'Connect'); #Horizontal separator my $hseparator_nav = Gtk2::HSeparator->new; #Progressbar for the waytemp upload and the uaspf.txt download $progressbar_waytemp3 = Gtk2::ProgressBar->new; $progressbar_uas = Gtk2::ProgressBar->new; #pack the widgets into the table $table_interface->attach_defaults( $label_nav_waypoint, 0, 2, 0, 1); $table_interface->attach_defaults( $spacer1, 0, 2, 1, 2); $table_interface->attach_defaults( $swindow_nav, 0, 2, 2, 3); $table_interface->attach_defaults( $spacer2, 0, 2, 3, 4); $table_interface->attach_defaults( $button_nav_waypoint, 0, 2, 4, 5); $table_interface->attach_defaults( $spacer3, 0, 2, 5, 6); $table_interface->attach_defaults( $hseparator_nav, 0, 2, 6, 7); $table_interface->attach_defaults( $label_uploading, 0, 2, 7, 8); $table_interface->attach_defaults( $label_nav_waytemp, 0, 1, 8, 9); $table_interface->attach_defaults( $progressbar_waytemp3, 0, 2, 9, 10) +; $table_interface->attach_defaults( $spacer4, 0, 2, 10, 11); $table_interface->attach_defaults( $label_downloading, 0, 2, 11, 12); $table_interface->attach_defaults( $label_nav_uas, 0, 1, 12, 13); $table_interface->attach_defaults( $progressbar_uas, 0, 2, 13, 14); $table_interface->attach_defaults( $button_nav_connect, 1, 2, 14, 15); #Button function; starts the connection $button_nav_waypoint->signal_connect( 'button-press-event' => sub { my + $num = $buffer->get_buffer; print "$num\n"}); $button_nav_connect->signal_connect( 'button-press-event' => sub { my +$button_nav_label = $button_nav_connect->get_label; if ( $button_nav_l +abel eq 'Connect') { $button_nav_co +nnect->set_label( 'Disconnect'); } else { $button_nav_co +nnect->set_label( 'Connect'); } }); #add the widgets to the window: widgets->table->eventbox->window $eventbox_interface->add( $table_interface); $interface->add( $eventbox_interface); $interface->show_all; $interface->signal_connect( 'button-release-event' => sub { Gtk2->main +_quit}); #allows the popup window entries to work correctly my $rc = Gtk2::Gdk->keyboard_grab($interface->window, 0 ,Gtk2->get_cur +rent_event_time); Gtk2->main;
In reply to Gtk2: TextView to file by deadpickle
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |