project3v3 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ require 'snoo'
2
+
3
+ class RedditLoginWindow #(change name)
4
+ @reddit
5
+ include GladeGUI
6
+ def initialize()
7
+ @reddit = Snoo::Client.new
8
+ end
9
+
10
+ def show()
11
+ load_glade(__FILE__) #loads file, glade/MyClass.glade into @builder
12
+ #set_glade_all() #populates glade controls with insance variables (i.e. Myclass.label1)
13
+ show_window()
14
+ end
15
+
16
+ def button1__clicked(*argv)
17
+ @username = @builder["entry1"].text
18
+ @password = @builder["entry2"].text
19
+ if @username.size > 0 && @password.size > 0
20
+ if (@reddit.log_in @username, @password).code == 200
21
+ self.destroy_window()
22
+ @redditWin = RedditWindowGUI.new()
23
+ @redditWin.show(self)
24
+ end
25
+ else
26
+ @builder["label3"].text = "Please enter a valid username and/or password"
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -0,0 +1,10 @@
1
+ class RedditWindow #(change name)
2
+
3
+ include GladeGUI
4
+
5
+ def show()
6
+ load_glade(__FILE__)
7
+ show_window()
8
+ end
9
+
10
+ end
@@ -0,0 +1,20 @@
1
+ class RedditWindowGUI #< RedditWindow #(change name)
2
+
3
+ include GladeGUI
4
+
5
+ def show(parent)
6
+ load_glade(__FILE__)
7
+ set_glade_variables(self)
8
+ show_window()
9
+ end
10
+
11
+ def button1__clicked(*argv)
12
+ @twitterWin = TwitterLoginWindow.new(self) #self = parent
13
+ @twitterWin.show(self)
14
+ end
15
+
16
+ def from_child(client)
17
+ client.update("Tweeting from ruby")
18
+ end
19
+
20
+ end
@@ -0,0 +1,48 @@
1
+ require 'twitter_oauth'
2
+ require 'launchy'
3
+
4
+ class TwitterLoginWindow #(change name)
5
+
6
+ include GladeGUI
7
+
8
+ def initialize(parent)
9
+ @parent = parent
10
+ @client = TwitterOAuth::Client.new(
11
+ :consumer_key => 'RMGCd8r8G5q2KuOfKB8Ycg',
12
+ :consumer_secret => 'OZVcqyXdPf5cYOHivZmMxcAPHE6oaaZJR0OmYmVECI'
13
+ )
14
+ end
15
+
16
+ def show(parent)
17
+ load_glade(__FILE__, parent) # now child will close with parent
18
+ #set_glade_all() #populates glade controls with insance variables (i.e. Myclass.label1)
19
+ show_window()
20
+ end
21
+
22
+ def twitterlogin__clicked(*argv)
23
+ if(@builder["entry1"].text.size == 0)
24
+ @request = @client.request_token
25
+ @url = @request.authorize_url
26
+ @parsed_url = URI.parse( @url )
27
+ Launchy.open( @parsed_url )
28
+ end
29
+
30
+ @builder["entry1"].sensitive = true
31
+
32
+ if(@builder["entry1"].text.size > 0)
33
+ @pin = @builder["entry1"].text.to_i
34
+ @account = @client.authorize(
35
+ @request.token,
36
+ @request.secret,
37
+ :oauth_verifier => @pin
38
+ )
39
+ if @client.authorized?
40
+ #@client.update("TWEEETER FROM RUBY")
41
+ @parent.from_child(@client)
42
+ end
43
+ destroy_window()
44
+ end
45
+
46
+ end
47
+
48
+ end
@@ -0,0 +1,126 @@
1
+ <?xml version="1.0"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="modal">True</property>
8
+ <property name="window_position">center-always</property>
9
+ <child>
10
+ <object class="GtkVBox" id="vbox2">
11
+ <property name="visible">True</property>
12
+ <child>
13
+ <object class="GtkVBox" id="vbox1">
14
+ <property name="visible">True</property>
15
+ <property name="orientation">vertical</property>
16
+ <child>
17
+ <object class="GtkHBox" id="hbox1">
18
+ <property name="visible">True</property>
19
+ <child>
20
+ <object class="GtkLabel" id="label1">
21
+ <property name="visible">True</property>
22
+ <property name="label" translatable="yes">Username</property>
23
+ </object>
24
+ <packing>
25
+ <property name="padding">20</property>
26
+ <property name="position">0</property>
27
+ </packing>
28
+ </child>
29
+ <child>
30
+ <object class="GtkEntry" id="entry1">
31
+ <property name="visible">True</property>
32
+ <property name="can_focus">True</property>
33
+ <property name="invisible_char">&#x25CF;</property>
34
+ <property name="caps_lock_warning">False</property>
35
+ </object>
36
+ <packing>
37
+ <property name="padding">10</property>
38
+ <property name="position">1</property>
39
+ </packing>
40
+ </child>
41
+ </object>
42
+ <packing>
43
+ <property name="padding">10</property>
44
+ <property name="position">0</property>
45
+ </packing>
46
+ </child>
47
+ <child>
48
+ <object class="GtkHBox" id="hbox2">
49
+ <property name="visible">True</property>
50
+ <child>
51
+ <object class="GtkLabel" id="label2">
52
+ <property name="visible">True</property>
53
+ <property name="label" translatable="yes">Password</property>
54
+ </object>
55
+ <packing>
56
+ <property name="padding">20</property>
57
+ <property name="position">0</property>
58
+ </packing>
59
+ </child>
60
+ <child>
61
+ <object class="GtkEntry" id="entry2">
62
+ <property name="visible">True</property>
63
+ <property name="can_focus">True</property>
64
+ <property name="visibility">False</property>
65
+ <property name="invisible_char">&#x25CF;</property>
66
+ </object>
67
+ <packing>
68
+ <property name="padding">10</property>
69
+ <property name="position">1</property>
70
+ </packing>
71
+ </child>
72
+ </object>
73
+ <packing>
74
+ <property name="padding">10</property>
75
+ <property name="position">1</property>
76
+ </packing>
77
+ </child>
78
+ <child>
79
+ <object class="GtkVBox" id="vbox3">
80
+ <property name="visible">True</property>
81
+ <property name="orientation">vertical</property>
82
+ <child>
83
+ <object class="GtkLabel" id="label3">
84
+ <property name="visible">True</property>
85
+ </object>
86
+ <packing>
87
+ <property name="position">0</property>
88
+ </packing>
89
+ </child>
90
+ <child>
91
+ <object class="GtkHButtonBox" id="hbuttonbox1">
92
+ <property name="visible">True</property>
93
+ <child>
94
+ <object class="GtkButton" id="button1">
95
+ <property name="label" translatable="yes">Login</property>
96
+ <property name="visible">True</property>
97
+ <property name="can_focus">True</property>
98
+ <property name="receives_default">True</property>
99
+ </object>
100
+ <packing>
101
+ <property name="expand">False</property>
102
+ <property name="fill">False</property>
103
+ <property name="position">0</property>
104
+ </packing>
105
+ </child>
106
+ </object>
107
+ <packing>
108
+ <property name="padding">5</property>
109
+ <property name="position">1</property>
110
+ </packing>
111
+ </child>
112
+ </object>
113
+ <packing>
114
+ <property name="padding">2</property>
115
+ <property name="position">2</property>
116
+ </packing>
117
+ </child>
118
+ </object>
119
+ <packing>
120
+ <property name="position">0</property>
121
+ </packing>
122
+ </child>
123
+ </object>
124
+ </child>
125
+ </object>
126
+ </interface>
@@ -0,0 +1,132 @@
1
+ <?xml version="1.0"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="modal">True</property>
8
+ <property name="window_position">center-always</property>
9
+ <child>
10
+ <object class="GtkVBox" id="vbox1">
11
+ <property name="visible">True</property>
12
+ <property name="orientation">vertical</property>
13
+ <child>
14
+ <placeholder/>
15
+ </child>
16
+ <child>
17
+ <object class="GtkHBox" id="hbox1">
18
+ <property name="visible">True</property>
19
+ <child>
20
+ <object class="GtkVBox" id="vbox2">
21
+ <property name="visible">True</property>
22
+ <property name="orientation">vertical</property>
23
+ <child>
24
+ <object class="GtkHButtonBox" id="hbuttonbox1">
25
+ <property name="visible">True</property>
26
+ <child>
27
+ <object class="GtkImage" id="image1">
28
+ <property name="visible">True</property>
29
+ <property name="pixbuf">twitter.jpg</property>
30
+ </object>
31
+ <packing>
32
+ <property name="expand">False</property>
33
+ <property name="fill">False</property>
34
+ <property name="position">0</property>
35
+ </packing>
36
+ </child>
37
+ </object>
38
+ <packing>
39
+ <property name="expand">False</property>
40
+ <property name="fill">False</property>
41
+ <property name="position">0</property>
42
+ </packing>
43
+ </child>
44
+ <child>
45
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
46
+ <property name="visible">True</property>
47
+ <property name="can_focus">True</property>
48
+ <property name="hscrollbar_policy">automatic</property>
49
+ <property name="vscrollbar_policy">automatic</property>
50
+ <child>
51
+ <object class="GtkButton" id="button1">
52
+ <property name="label" translatable="yes">button</property>
53
+ <property name="visible">True</property>
54
+ <property name="can_focus">True</property>
55
+ <property name="receives_default">True</property>
56
+ </object>
57
+ </child>
58
+ </object>
59
+ <packing>
60
+ <property name="position">1</property>
61
+ </packing>
62
+ </child>
63
+ <child>
64
+ <placeholder/>
65
+ </child>
66
+ </object>
67
+ <packing>
68
+ <property name="position">0</property>
69
+ </packing>
70
+ </child>
71
+ <child>
72
+ <object class="GtkHBox" id="hbox2">
73
+ <property name="visible">True</property>
74
+ <child>
75
+ <object class="GtkFrame" id="frame1">
76
+ <property name="visible">True</property>
77
+ <property name="label_xalign">0</property>
78
+ <property name="shadow_type">none</property>
79
+ <child>
80
+ <object class="GtkAlignment" id="alignment1">
81
+ <property name="visible">True</property>
82
+ <property name="left_padding">12</property>
83
+ <child>
84
+ <placeholder/>
85
+ </child>
86
+ </object>
87
+ </child>
88
+ <child type="label">
89
+ <object class="GtkLabel" id="label1">
90
+ <property name="visible">True</property>
91
+ <property name="label" translatable="yes">&lt;b&gt;frame1&lt;/b&gt;</property>
92
+ <property name="use_markup">True</property>
93
+ </object>
94
+ </child>
95
+ </object>
96
+ <packing>
97
+ <property name="position">0</property>
98
+ </packing>
99
+ </child>
100
+ <child>
101
+ <object class="GtkVButtonBox" id="vbuttonbox1">
102
+ <property name="visible">True</property>
103
+ <child>
104
+ <object class="GtkImage" id="image2">
105
+ <property name="visible">True</property>
106
+ <property name="stock">gtk-missing-image</property>
107
+ </object>
108
+ <packing>
109
+ <property name="expand">False</property>
110
+ <property name="fill">False</property>
111
+ <property name="position">0</property>
112
+ </packing>
113
+ </child>
114
+ </object>
115
+ <packing>
116
+ <property name="position">1</property>
117
+ </packing>
118
+ </child>
119
+ </object>
120
+ <packing>
121
+ <property name="position">1</property>
122
+ </packing>
123
+ </child>
124
+ </object>
125
+ <packing>
126
+ <property name="position">1</property>
127
+ </packing>
128
+ </child>
129
+ </object>
130
+ </child>
131
+ </object>
132
+ </interface>
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="modal">True</property>
9
+ <property name="window_position">center-always</property>
10
+ <child>
11
+ <object class="GtkVBox" id="vbox1">
12
+ <property name="visible">True</property>
13
+ <property name="can_focus">False</property>
14
+ <child>
15
+ <object class="GtkHBox" id="hbox1">
16
+ <property name="visible">True</property>
17
+ <property name="can_focus">False</property>
18
+ <child>
19
+ <object class="GtkLabel" id="label1">
20
+ <property name="can_focus">False</property>
21
+ <property name="label" translatable="yes">Pin Code</property>
22
+ </object>
23
+ <packing>
24
+ <property name="expand">True</property>
25
+ <property name="fill">True</property>
26
+ <property name="padding">20</property>
27
+ <property name="position">0</property>
28
+ </packing>
29
+ </child>
30
+ <child>
31
+ <object class="GtkEntry" id="entry1">
32
+ <property name="sensitive">False</property>
33
+ <property name="can_focus">True</property>
34
+ <property name="invisible_char">●</property>
35
+ <property name="primary_icon_activatable">False</property>
36
+ <property name="secondary_icon_activatable">False</property>
37
+ <property name="primary_icon_sensitive">True</property>
38
+ <property name="secondary_icon_sensitive">True</property>
39
+ </object>
40
+ <packing>
41
+ <property name="expand">True</property>
42
+ <property name="fill">True</property>
43
+ <property name="padding">20</property>
44
+ <property name="position">1</property>
45
+ </packing>
46
+ </child>
47
+ </object>
48
+ <packing>
49
+ <property name="expand">True</property>
50
+ <property name="fill">True</property>
51
+ <property name="position">0</property>
52
+ </packing>
53
+ </child>
54
+ <child>
55
+ <object class="GtkHButtonBox" id="hbuttonbox1">
56
+ <property name="visible">True</property>
57
+ <property name="can_focus">False</property>
58
+ <child>
59
+ <object class="GtkButton" id="twitterlogin">
60
+ <property name="label" translatable="yes">Login</property>
61
+ <property name="visible">True</property>
62
+ <property name="can_focus">True</property>
63
+ <property name="receives_default">True</property>
64
+ </object>
65
+ <packing>
66
+ <property name="expand">False</property>
67
+ <property name="fill">False</property>
68
+ <property name="padding">20</property>
69
+ <property name="position">0</property>
70
+ </packing>
71
+ </child>
72
+ </object>
73
+ <packing>
74
+ <property name="expand">True</property>
75
+ <property name="fill">True</property>
76
+ <property name="position">1</property>
77
+ </packing>
78
+ </child>
79
+ </object>
80
+ </child>
81
+ </object>
82
+ </interface>
data/main.rb ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'vrlib'
4
+
5
+
6
+
7
+ #make program output in real time so errors visible in VR.
8
+ STDOUT.sync = true
9
+ STDERR.sync = true
10
+
11
+ my_path = File.expand_path(File.dirname(__FILE__))
12
+ require_all Dir.glob(my_path + "/bin/**/*.rb")
13
+
14
+ RedditLoginWindow.new.show
15
+
data/requires.rb ADDED
@@ -0,0 +1,15 @@
1
+ #Global required libraries (add your own):
2
+ require 'rubygems'
3
+ require 'gtk2'
4
+ require 'require_all'
5
+ require 'vrlib'
6
+
7
+
8
+
9
+ #make program output in real time so errors visible in VR.
10
+ STDOUT.sync = true
11
+ STDERR.sync = true
12
+
13
+ my_path = File.expand_path(File.dirname(__FILE__))
14
+ require_all Dir.glob(my_path + "/lib/**/*.rb")
15
+ require_all Dir.glob(my_path + "/bin/**/*.rb")
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: project3v3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Your Name
9
+ autorequire:
10
+ bindir:
11
+ - .
12
+ cert_chain: []
13
+ date: 2013-05-07 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: vrlib
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.0.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.0.1
31
+ - !ruby/object:Gem::Dependency
32
+ name: gtk2
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 0.0.1
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 0.0.1
47
+ - !ruby/object:Gem::Dependency
48
+ name: require_all
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.1
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 0.0.1
63
+ description: Full description here
64
+ email: you@yoursite.com
65
+ executables:
66
+ - main.rb
67
+ extensions: []
68
+ extra_rdoc_files: []
69
+ files:
70
+ - bin/RedditLoginWindow.rb
71
+ - bin/RedditWindow.rb
72
+ - bin/RedditWindowGUI.rb
73
+ - bin/TwitterLoginWindow.rb
74
+ - main.rb
75
+ - requires.rb
76
+ - bin/glade/RedditLoginWindow.glade
77
+ - bin/glade/RedditWindowGUI.glade
78
+ - bin/glade/TwitterLoginWindow.glade
79
+ - ./main.rb
80
+ homepage: http://www.yoursite.org/
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - .
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project: nowarning
100
+ rubygems_version: 1.8.25
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Short Description Here.
104
+ test_files: []