From a0e258f50694ef9b56844f5de59017a1ed853b0c Mon Sep 17 00:00:00 2001 From: badetitou Date: Thu, 8 Dec 2022 21:35:40 +0100 Subject: [PATCH 1/4] UI pharo 11 --- .../IRCBasicDisplay.class/class/on..st | 2 +- .../IRCBasicDisplay.class/properties.json | 2 +- .../IRCBasicInput.class/class/connection..st | 2 +- .../IRCBasicInput.class/class/defaultSpec.st | 11 ----------- .../IRCBasicInput.class/instance/addTextToLog..st | 2 +- .../IRCBasicInput.class/instance/defaultLayout.st | 7 +++++++ .../instance/{handleInput.st => handleInput..st} | 5 ++--- .../instance/initializeWidgets.st | 14 ++++++++++---- .../IRCBasicInput.class/properties.json | 2 +- 9 files changed, 24 insertions(+), 23 deletions(-) delete mode 100644 Pharo-IRC-GUI.package/IRCBasicInput.class/class/defaultSpec.st create mode 100644 Pharo-IRC-GUI.package/IRCBasicInput.class/instance/defaultLayout.st rename Pharo-IRC-GUI.package/IRCBasicInput.class/instance/{handleInput.st => handleInput..st} (79%) diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/on..st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/on..st index 1f43815..3a21d21 100644 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/on..st +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/on..st @@ -5,5 +5,5 @@ on: anIRCConnection to connect" | model | model := self connection: anIRCConnection. - model openWithSpec. + model open. model window whenClosedDo: [ model windowCloseAction ]. \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/properties.json b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/properties.json index aa727b7..caf7f6f 100644 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/properties.json +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/properties.json @@ -1,6 +1,6 @@ { "commentStamp" : "EricGade 2/23/2018 17:58", - "super" : "ComposableModel", + "super" : "SpPresenter", "category" : "Pharo-IRC-GUI", "classinstvars" : [ ], "pools" : [ ], diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/class/connection..st b/Pharo-IRC-GUI.package/IRCBasicInput.class/class/connection..st index 70d3900..fc1e1e5 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/class/connection..st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/class/connection..st @@ -10,4 +10,4 @@ connection: anIRCConnection when: IRCJoinedChannelAnnouncement send: #handleJoinChannel: to: inst. - ^ inst openWithSpec. \ No newline at end of file + ^ inst open. \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/class/defaultSpec.st b/Pharo-IRC-GUI.package/IRCBasicInput.class/class/defaultSpec.st deleted file mode 100644 index 428965b..0000000 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/class/defaultSpec.st +++ /dev/null @@ -1,11 +0,0 @@ -specs -defaultSpec - - ^ SpecLayout composed - newColumn: [ :row | - row - newColumn: [ :column | - column newRow: [:r | - r newColumn: #logArea ] - ]; - newRow: #input height: 25 ]. \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st index 9836f3c..9dcd38f 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st @@ -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)." \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/defaultLayout.st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/defaultLayout.st new file mode 100644 index 0000000..fec0bd7 --- /dev/null +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/defaultLayout.st @@ -0,0 +1,7 @@ +initialization +defaultLayout + + ^ SpBoxLayout newTopToBottom + add: logArea; + add: input height: 25; + yourself \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/handleInput.st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/handleInput..st similarity index 79% rename from Pharo-IRC-GUI.package/IRCBasicInput.class/instance/handleInput.st rename to Pharo-IRC-GUI.package/IRCBasicInput.class/instance/handleInput..st index ce64669..e081b59 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/handleInput.st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/handleInput..st @@ -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: ''. \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st index e70a7ee..39389d3 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st @@ -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]. \ No newline at end of file + self input whenSubmitDo: [ :text | self handleInput: text ] \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/properties.json b/Pharo-IRC-GUI.package/IRCBasicInput.class/properties.json index 6006b19..5bc9b42 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/properties.json +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/properties.json @@ -1,6 +1,6 @@ { "commentStamp" : "EricGade 2/23/2018 18:05", - "super" : "ComposableModel", + "super" : "SpPresenter", "category" : "Pharo-IRC-GUI", "classinstvars" : [ ], "pools" : [ ], From 8a0495c657355f6380c570925563b554b41a9e0e Mon Sep 17 00:00:00 2001 From: badetitou Date: Thu, 8 Dec 2022 21:59:20 +0100 Subject: [PATCH 2/4] continue update UI --- .../class/defaultSpec.st | 12 ------------ .../instance/defaultLayout.st | 10 ++++++++++ .../instance/initializeWidgets.st | 2 +- .../IRCBasicDisplay.class/class/defaultSpec.st | 6 ------ .../instance/connection..st | 18 ++++++++---------- .../instance/defaultLayout.st | 6 ++++++ .../instance/handleJoinChannel..st | 6 +----- .../instance/initializeWidgets.st | 10 ++-------- .../instance/addTextToLog..st | 2 +- .../instance/initializeWidgets.st | 2 +- 10 files changed, 30 insertions(+), 44 deletions(-) delete mode 100644 Pharo-IRC-GUI.package/IRCBasicChannelInput.class/class/defaultSpec.st create mode 100644 Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/defaultLayout.st delete mode 100644 Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/defaultSpec.st create mode 100644 Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/defaultLayout.st diff --git a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/class/defaultSpec.st b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/class/defaultSpec.st deleted file mode 100644 index e510011..0000000 --- a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/class/defaultSpec.st +++ /dev/null @@ -1,12 +0,0 @@ -specs -defaultSpec - - ^ SpecLayout composed - newColumn: [ :row | - row - newColumn: [ :column | - column newRow: [:r | - r newColumn: #logArea. - r newColumn: #users width: 200 ]. - ]; - newRow: #input height: 25 ]. \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/defaultLayout.st b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/defaultLayout.st new file mode 100644 index 0000000..7efc26e --- /dev/null +++ b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/defaultLayout.st @@ -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 \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st index ae9a4dd..d614b8a 100644 --- a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st +++ b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st @@ -1,7 +1,7 @@ initialization initializeWidgets super initializeWidgets. - users := self instantiate: ListModel. + users := self newList. users displayBlock: [ :item | item nickname ]. diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/defaultSpec.st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/defaultSpec.st deleted file mode 100644 index 9975a62..0000000 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/class/defaultSpec.st +++ /dev/null @@ -1,6 +0,0 @@ -specs -defaultSpec - - ^ SpecLayout composed - newColumn: [ :column | - column add: #channelTabs ] \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/connection..st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/connection..st index 8be5464..285eb1e 100644 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/connection..st +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/connection..st @@ -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. \ No newline at end of file + self channelTabs addPage: (SpNotebookPage + title: anIRCConnection hostname + provider: [ self serverLog ]) \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/defaultLayout.st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/defaultLayout.st new file mode 100644 index 0000000..9acefcf --- /dev/null +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/defaultLayout.st @@ -0,0 +1,6 @@ +accessing +defaultLayout + + ^ SpBoxLayout newTopToBottom + add: channelTabs; + yourself \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st index 3454b59..851329e 100644 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st @@ -1,7 +1,6 @@ as yet unclassified handleJoinChannel: anAnnouncement | newTab chanInput | - newTab := TabModel new. chanInput := IRCBasicChannelInput new. chanInput addSubscriber: (anAnnouncement channel connection) on: #handleInputAnnouncement:; @@ -18,10 +17,7 @@ handleJoinChannel: anAnnouncement when: IRCQuitAnnouncement send: #connectionQuit: to: chanInput. - newTab - label: (anAnnouncement channel name); - contents: chanInput buildWithSpec. - self channelTabs addTab: newTab. + self channelTabs addPage: (SpNotebookPage title: (anAnnouncement channel name) provider: [ chanInput build ]).. newTab selected: true. chanInput input textArea keyboardFocusChange: true. diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/initializeWidgets.st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/initializeWidgets.st index fd5144e..038f889 100644 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/initializeWidgets.st +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/initializeWidgets.st @@ -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 diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st index 9dcd38f..5de0498 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st @@ -1,5 +1,5 @@ adding addTextToLog: aText self logText: aText. - self logArea insert: aText at: self logArea text size. + self logArea insert: aText printString at: self logArea text size. "self logArea sourceTextArea setScrollValue: (self logArea sourceTextArea extent)." \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st index 39389d3..f6f4819 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/initializeWidgets.st @@ -13,4 +13,4 @@ initializeWidgets formatter := IRCBasicTextFormatter new. cmdHandler := IRCTextCommandHandler new. cmdHandler connection: self connection. - self input whenSubmitDo: [ :text | self handleInput: text ] \ No newline at end of file + self input whenSubmitDo: [ :text | text ifNotEmpty: [ self handleInput: text ] ] \ No newline at end of file From 173cf71db844737154eb91cdc7d7312f1c5a421e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Verhaeghe?= Date: Thu, 8 Dec 2022 22:02:29 +0100 Subject: [PATCH 3/4] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2bcffbf..130ad5a 100644 --- a/README.md +++ b/README.md @@ -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. ``` @@ -26,7 +26,7 @@ connection nickname: 'pharo-user'; hostname: 'irc.freenode.net'. display := IRCBasicDisplay connection: connection. -display openWithSpec. +display open. connection connect. ``` ## IRCBasicDisplay commands ## From bd10b57de5b4e3cb87722f0198cb7ba65afff41c Mon Sep 17 00:00:00 2001 From: badetitou Date: Thu, 8 Dec 2022 22:08:06 +0100 Subject: [PATCH 4/4] can join a chanel --- .../instance/initializeWidgets.st | 2 +- .../instance/handleJoinChannel..st | 27 +++++++++---------- .../instance/addTextToLog..st | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st index d614b8a..38dbb3c 100644 --- a/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st +++ b/Pharo-IRC-GUI.package/IRCBasicChannelInput.class/instance/initializeWidgets.st @@ -3,6 +3,6 @@ initializeWidgets super initializeWidgets. users := self newList. users - displayBlock: [ :item | + display: [ :item | item nickname ]. self commandHandler channel: self channel. \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st index 851329e..0eccbbe 100644 --- a/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st +++ b/Pharo-IRC-GUI.package/IRCBasicDisplay.class/instance/handleJoinChannel..st @@ -1,24 +1,23 @@ as yet unclassified handleJoinChannel: anAnnouncement - | newTab chanInput | - 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. - self channelTabs addPage: (SpNotebookPage title: (anAnnouncement channel name) provider: [ chanInput build ]).. - newTab selected: true. - chanInput input textArea keyboardFocusChange: true. - - \ No newline at end of file + self channelTabs addPage: (SpNotebookPage + title: anAnnouncement channel name + provider: [ chanInput ]) \ No newline at end of file diff --git a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st index 5de0498..9dcd38f 100644 --- a/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st +++ b/Pharo-IRC-GUI.package/IRCBasicInput.class/instance/addTextToLog..st @@ -1,5 +1,5 @@ adding addTextToLog: aText self logText: aText. - self logArea insert: aText printString at: self logArea text size. + self logArea insert: aText at: self logArea text size. "self logArea sourceTextArea setScrollValue: (self logArea sourceTextArea extent)." \ No newline at end of file