|< 1 2 >| | 19 Einträge, 2 Seiten |
use modul;
QuoteWenn ich jetzt die Datei 'programm.pl' aufrufe, zeigt es leider keine grafische Oberfläche an (das liegt an dem eingebundenen Modul, habs mal auskommentiert und da war die grafische Oberfläche wieder da).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
#!/usr/bin/perl -w use strict; use warnings; use Tk; use modul; my @namen = ( "Allgemein", "Bücher", "Einkaufen", "Wikipedia", "Zeitung" ); my @orte = ( 'E:\Eigene Dateien\Programme\Scrutator\img\icons\minilupe.gif', 'E:\Eigene Dateien\Programme\Scrutator\img\icons\buch.gif', 'E:\Eigene Dateien\Programme\Scrutator\img\icons\einkaufswagen.gif', 'E:\Eigene Dateien\Programme\Scrutator\img\icons\wikipedia2.gif', 'E:\Eigene Dateien\Programme\Scrutator\img\icons\zeitung.gif' ); my $top = MainWindow -> new(-background => 'black', -height => '768', -width => '1024'); $top -> title('Scrutator'); # Navigationsframe my $navi = $top -> Frame (-background => 'black'); $navi -> place(-x=>'3p', -y => '3p'); # Erster Button - Lupe my $lupe = $navi->Photo(-file => 'E:\Eigene Dateien\Programme\Scrutator\img\lupe.gif'); $navi->Button(-image => $lupe, -relief=>'flat', -background => 'black', -activebackground => 'red')->grid(-row=>'0', -column=>'0'); # Zweiter Button - Ordner my $ordner = $navi->Photo(-file => 'E:\Eigene Dateien\Programme\Scrutator\img\ordner.gif'); $navi->Button(-image => $ordner, -relief=>'flat', -background => 'black', -activebackground => 'red')->grid(-row=>'1', -column=>'0'); # Profilframe my $profilframe = $top -> Frame (-background => 'sky blue', -height => '249p', -width => '250p'); $profilframe -> place(-x=>'3p', -y => '140p'); # Profiltext # Bilder definieren my $allgemein = $profilframe->Photo(-file => $orte[0]); my $buecher = $profilframe->Photo(-file => $orte[1]); my $einkaufen = $profilframe->Photo(-file => $orte[2]); my $wiki = $profilframe->Photo(-file => $orte[3]); my $zeitung = $profilframe->Photo(-file => $orte[4]); # Überschrift $profilframe->Label( -text=>"Meine Profile", -background => 'sky blue', -font=>'{Bimini} 14 {bold}' )->place(-x=>'5'); # Allgemein $profilframe->Label( -image => $allgemein, -background => 'sky blue' )->place(-x=>'5', -y => '53'); $profilframe->Button( -text=>$namen[0], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '50'); # Bücher $profilframe->Label( -image => $buecher, -background => 'sky blue' )->place(-x=>'5', -y => '88'); $profilframe->Button( -text=>$namen[1], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '85'); # Einkaufen $profilframe->Label( -image => $einkaufen, -background => 'sky blue' )->place(-x=>'5', -y => '123'); $profilframe->Button( -text=>$namen[2], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '120'); # Wikipedia $profilframe->Label( -image => $wiki, -background => 'sky blue' )->place(-x=>'5', -y => '158'); $profilframe->Button( -text=>$namen[3], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '155'); # Zeitung $profilframe->Label( -image => $zeitung, -background => 'sky blue' )->place(-x=>'5', -y => '193'); $profilframe->Button( -text=>$namen[4], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '190'); MainLoop;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
#!/usr/bin/perl -w use strict; use warnings; my @language; my @name; my @path; my @description; my @included; my @ignored; my @included_end; my @ignored_end; # Profil-Datei einlesen my $rw = open(FILE,'E:\Eigene Dateien\Programme\Scrutator\profiles.xml'); my @array = <FILE>; ; # Zeilen bestimmen my $laenge = @array; # XML-Datei darf nur bestimmte Länge haben if(($laenge - 2) % 9 == 0) { # Einleitungszeile - Profil und Sprache for(my $i = 2;$i < $laenge;$i += 9) { # Unnötiges abschneiden my $langstring = substr($array[$i],8); # Prüfen, ob Sprachattribut vorhanden ist if($langstring =~ /language/) { # Sprache ermitteln my $kurzlangstring = substr($langstring,10); for(my $j = 0;$j < 3;$j++) { chop($kurzlangstring); } my $length = @language; $language[$length] = $kurzlangstring; } else { my $length = @language; $language[$length] = "none"; } } # Zweite Zeile - Profilname for(my $i = 3;$i < $laenge;$i += 9) { # Unnötiges abschneiden my $langstring = substr($array[$i],8); # Name ermitteln for(my $j = 0;$j < 8;$j++) { chop($langstring); } my $length = @name; $name[$length] = $langstring; } # Dritte Zeile - Icon-Pfad for(my $i = 4;$i < $laenge;$i += 9) { # Unnötiges abschneiden my $langstring = substr($array[$i],10); # Pfad ermitteln for(my $j = 0;$j < 10;$j++) { chop($langstring); } my $length = @path; $path[$length] = $langstring; } # Vierte Zeile - Beschreibung for(my $i = 5;$i < $laenge;$i += 9) { # Unnötiges abschneiden my $langstring = substr($array[$i],15); # Beschreibung ermitteln for(my $j = 0;$j < 15;$j++) { chop($langstring); } my $length = @description; $description[$length] = $langstring; } # Fünfte bis achte Zeile - Optionen for(my $i = 6;$i < $laenge;$i += 9) { # Optionen-Tag überprüfen my $options = $array[$i]; if($options =~ /options/) { for(my $g = 7;$i < $laenge;$i += 9) { # Unnötiges abschneiden my $langstring = substr($array[$g],14); for(my $j = 0;$j < 12;$j++) { chop($langstring); } my $length = @included; $included[$length] = $langstring; } for(my $h = 8;$h < $laenge;$h += 9) { # Unnötiges Abschneiden my $langstring = substr($array[$h],13); for(my $j = 0;$j < 11;$j++) { chop($langstring); } my $length = @ignored; $ignored[$length] = $langstring; } } } } else { my $fehler = "Ungültige oder fehlerhafte Profildatei!"; } my $length = @included; my $length2 = @ignored; for(my $i = 0;$i < $length;$i++) { if($included[$i] =~ /,/) { my @splitted = split(/,/,$included[$i]); my $splitlaenge = @splitted; for(my $k = 0;$k < $splitlaenge;$k++) { $included_end[$k] = $splitted[$k]; } } else { for(my $i = 0;$i < $length;$i++) { $included_end[$i] = $included[$i]; } } } for(my $i = 0;$i < $length2;$i++) { if($ignored[$i] =~ /,/) { my @splitted = split(/,/,$ignored[$i]); my $splitlaenge = @splitted; for(my $k = 0;$k < $splitlaenge;$k++) { $ignored_end[$k] = $splitted[$k]; } } else { for(my $i = 0;$i < $length2;$i++) { $ignored_end[$i] = $ignored[$i]; } } }
1
2
3
4
5
6
7
8
9
10
11
12
13
for my $elem(@included) {
if($elem =~ /,/) {
my @splitted = split(/,/,$elem);
for(0..(scalar @splitted)-1) {
$included_end[$_] = $splitted[$_];
}
}
else {
for my $i(0..(scalar @included)-1) {
$included_end[$i] = $included[$i];
}
}
}
|< 1 2 >| | 19 Einträge, 2 Seiten |