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

Update UI from Spec to Spec2 #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
as yet unclassified
defaultLayout

^ SpBoxLayout newTopToBottom
add: (SpBoxLayout newLeftToRight
add: logArea;
add: users width: 200;
yourself);
add: input height: 25;
yourself
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
initialization
initializeWidgets
super initializeWidgets.
users := self instantiate: ListModel.
users := self newList.
users
displayBlock: [ :item |
display: [ :item |
item nickname ].
self commandHandler channel: self channel.

This file was deleted.

2 changes: 1 addition & 1 deletion Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/on..st
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ on: anIRCConnection
to connect"
| model |
model := self connection: anIRCConnection.
model openWithSpec.
model open.
model window whenClosedDo: [ model windowCloseAction ].
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
accessing
connection: anIRCConnection
| newTab |
newTab := TabModel new.

connection := anIRCConnection.
self serverLog
self serverLog
connection: anIRCConnection;
addSubscriber: anIRCConnection on: #handleInputAnnouncement:;
commandHandler: (IRCTextCommandHandler new connection: anIRCConnection).
anIRCConnection
addSubscriber: (self serverLog) on: #handleIncoming:.
commandHandler:
(IRCTextCommandHandler new connection: anIRCConnection).
anIRCConnection addSubscriber: self serverLog on: #handleIncoming:.
anIRCConnection privAnnouncer
when: IRCJoinedChannelAnnouncement
send: #handleJoinChannel:
to: self.
newTab
label: (anIRCConnection hostname);
contents: (self serverLog buildWithSpec).
self channelTabs addTab: newTab.
self channelTabs addPage: (SpNotebookPage
title: anIRCConnection hostname
provider: [ self serverLog ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
accessing
defaultLayout

^ SpBoxLayout newTopToBottom
add: channelTabs;
yourself
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
as yet unclassified
handleJoinChannel: anAnnouncement
| newTab chanInput |
newTab := TabModel new.
chanInput := IRCBasicChannelInput new.

| chanInput |
chanInput := self instantiate: IRCBasicChannelInput.
chanInput
addSubscriber: (anAnnouncement channel connection) on: #handleInputAnnouncement:;
channelName: (anAnnouncement channel name);
channel: (anAnnouncement channel);
addSubscriber: anAnnouncement channel connection
on: #handleInputAnnouncement:;
channelName: anAnnouncement channel name;
channel: anAnnouncement channel;
formatter: (IRCBasicTextFormatter new showOutbound: false).
anAnnouncement channel
addSubscriber: chanInput on: #handleIncoming:.
(anAnnouncement channel privAnnouncer)
anAnnouncement channel addSubscriber: chanInput on: #handleIncoming:.
anAnnouncement channel privAnnouncer
when: IRCChanInfoAnnouncement
send: #channelInfoUpdate:
to: chanInput.
(anAnnouncement channel privAnnouncer)
anAnnouncement channel privAnnouncer
when: IRCQuitAnnouncement
send: #connectionQuit:
to: chanInput.
newTab
label: (anAnnouncement channel name);
contents: chanInput buildWithSpec.
self channelTabs addTab: newTab.
newTab selected: true.
chanInput input textArea keyboardFocusChange: true.


self channelTabs addPage: (SpNotebookPage
title: anAnnouncement channel name
provider: [ chanInput ])
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
initialization
initializeWidgets
| tabItem |
channelTabs := self instantiate: TabManagerModel.
serverLog := IRCBasicInput new.
tabItem := TabModel new.
tabItem
label: 'No Connection';
contents: serverLog buildWithSpec.

channelTabs := self newNotebook.
serverLog := IRCBasicInput new

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commentStamp" : "EricGade 2/23/2018 17:58",
"super" : "ComposableModel",
"super" : "SpPresenter",
"category" : "Pharo-IRC-GUI",
"classinstvars" : [ ],
"pools" : [ ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ connection: anIRCConnection
when: IRCJoinedChannelAnnouncement
send: #handleJoinChannel:
to: inst.
^ inst openWithSpec.
^ inst open.
11 changes: 0 additions & 11 deletions Pharo-IRC-GUI.package/IRCBasicInput.class/class/defaultSpec.st

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
adding
addTextToLog: aText
self logText: aText.
self logArea textArea appendText: aText.
self logArea insert: aText at: self logArea text size.
"self logArea sourceTextArea setScrollValue: (self logArea sourceTextArea extent)."
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialization
defaultLayout

^ SpBoxLayout newTopToBottom
add: logArea;
add: input height: 25;
yourself
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
as yet unclassified
handleInput
handleInput: text
"Action to take when the user
has submitted text in the input area"
| inputText |
"inputText := self input text veryDeepCopy.
(inputText beginsWith: '/')
ifTrue: [
self doCommand: inputText ]
ifFalse: [ self doNonCommandText: inputText ]."
self commandHandler parse: (self input text).
self commandHandler parse: text.
self input text: ''.
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
initialization
initializeWidgets
logArea := self instantiate: TextModel.
logArea color: (Color r: 0.301 g: 0.301 b: 0.301 alpha: 1.0).
input := self instantiate: TextInputFieldModel.

logArea := self newText.
logArea beNotEditable.
logArea color: (Color
r: 0.301
g: 0.301
b: 0.301
alpha: 1.0).
input := self newTextInput.
ann := Announcer new.
formatter := IRCBasicTextFormatter new.
cmdHandler := IRCTextCommandHandler new.
cmdHandler connection: self connection.
self input whenTextIsAccepted: [self handleInput].
self input whenSubmitDo: [ :text | text ifNotEmpty: [ self handleInput: text ] ]
2 changes: 1 addition & 1 deletion Pharo-IRC-GUI.package/IRCBasicInput.class/properties.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commentStamp" : "EricGade 2/23/2018 18:05",
"super" : "ComposableModel",
"super" : "SpPresenter",
"category" : "Pharo-IRC-GUI",
"classinstvars" : [ ],
"pools" : [ ],
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To easily install everything with Metacello:
```smalltalk
Metacello new
baseline: 'PharoIRC';
repository: 'github://darth-cheney/pharo-irc';
repository: 'github://badetitou/pharo-irc';
load.
```

Expand All @@ -26,7 +26,7 @@ connection
nickname: 'pharo-user';
hostname: 'irc.freenode.net'.
display := IRCBasicDisplay connection: connection.
display openWithSpec.
display open.
connection connect.
```
## IRCBasicDisplay commands ##
Expand Down