forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBMethodObject.class.st
More file actions
76 lines (69 loc) · 1.81 KB
/
PBMethodObject.class.st
File metadata and controls
76 lines (69 loc) · 1.81 KB
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
Class {
#name : #PBMethodObject,
#superclass : #PBProxyObject,
#category : #'PythonBridge-Core'
}
{ #category : #accessing }
PBMethodObject class >> pythonClass [
^'method'
]
{ #category : #ui }
PBMethodObject >> asBrMenuWithSelfObjectHolder: aSelfObjectHolder [
^ BrMenuExplicit new
stencil: [ :aMenuModel |
| aCoderElement |
aCoderElement := (self gtSourceFor: GtPhlowView empty)
asElementDo: [ :e | e ].
aCoderElement addAptitude: (BrGlamorousPopoverDefiningMethodAptitude new
menuModel: aMenuModel).
aCoderElement ]
]
{ #category : #accessing }
PBMethodObject >> file [
| filename model |
filename := (self newCommandFactory
<< ('inspect.getfile' asP3GIdentifier callWith: {self});
sendAndWait) asFileReference.
model := GtLSPPythonModel onDirectory: filename parent.
^ GtLSPFileModel new
filename: filename;
directory: model;
yourself
]
{ #category : #ui }
PBMethodObject >> gtPhlowIncludesCompiledMethod: aCompiledMethod [
^ false
]
{ #category : #accessing }
PBMethodObject >> gtSourceFor: aView [
<gtView>
| sl |
[ sl := self sourceLines ] on: Exception do: [ ^ aView empty ].
^ aView forward
title: 'Source';
priority: 2;
object: [
GtLSPFileLocation new
lspFile: self file;
startPosition: (GtLSPPositionStructure new
line: sl second - 1;
character: 0;
yourself);
endPosition: (GtLSPPositionStructure new
line: sl second + sl first size - 2;
character: sl first last size - 1;
yourself) ];
view: #gtLiveFor:
]
{ #category : #accessing }
PBMethodObject >> source [
^ self newCommandFactory
<< ('inspect.getsource' asP3GIdentifier callWith: {self});
sendAndWait
]
{ #category : #accessing }
PBMethodObject >> sourceLines [
^ self newCommandFactory
<< ('inspect.getsourcelines' asP3GIdentifier callWith: {self});
sendAndWait
]