Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
/pythonnetPublic archive
forked frompythonnet/pythonnet

Commit6139989

Browse files
committed
Merge pull requestpythonnet#205 from vmuriart/master
Format and White-spacing
2 parents5631442 +aed2a8c commit6139989

File tree

139 files changed

+7916
-8133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+7916
-8133
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void Main(string[] args)
5454
```
5555
outputs:
5656
```
57-
1.0
57+
1.0
5858
-0.958924274663
5959
-0.6752620892
6060
float64

‎demo/helloform.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
# ===========================================================================
2-
# This software is subject to the provisions of the Zope Public License,
3-
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
# FOR A PARTICULAR PURPOSE.
8-
# ===========================================================================
9-
101
importclr
2+
113
SWF=clr.AddReference("System.Windows.Forms")
124
print (SWF.Location)
135
importSystem.Windows.FormsasWinForms
@@ -31,7 +23,7 @@ def __init__(self):
3123
self.button.Size=Size(820,20)
3224
self.button.TabIndex=2
3325
self.button.Text="Click Me!"
34-
26+
3527
# Register the event handler
3628
self.button.Click+=self.button_Click
3729

@@ -41,7 +33,7 @@ def __init__(self):
4133
self.textbox.TabIndex=1
4234
self.textbox.Size=Size(1260,40)
4335
self.textbox.Location=Point(160,24)
44-
36+
4537
# Add the controls to the form
4638
self.AcceptButton=self.button
4739
self.Controls.Add(self.button);
@@ -66,4 +58,3 @@ def main():
6658

6759
if__name__=='__main__':
6860
main()
69-

‎demo/splitter.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# ===========================================================================
2-
# This software is subject to the provisions of the Zope Public License,
3-
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
# FOR A PARTICULAR PURPOSE.
8-
# ===========================================================================
9-
101
importclr
112
importSystem.Windows.FormsasWinForms
123
fromSystem.DrawingimportColor,Size,Point
@@ -28,7 +19,6 @@ def __init__(self):
2819
self.splitter2=WinForms.Splitter()
2920
self.panel1=WinForms.Panel()
3021

31-
3222
# Set properties of TreeView control.
3323
self.treeView1.Dock=WinForms.DockStyle.Left
3424
self.treeView1.Width=self.ClientSize.Width/3
@@ -48,14 +38,14 @@ def __init__(self):
4838

4939
# Set properties of Panel's Splitter control.
5040
self.splitter2.Dock=WinForms.DockStyle.Top
51-
41+
5242
# Width is irrelevant if splitter is docked to Top.
5343
self.splitter2.Height=3
54-
44+
5545
# Use a different color to distinguish the two splitters.
5646
self.splitter2.BackColor=Color.Blue
5747
self.splitter2.TabIndex=1
58-
48+
5949
# Set TabStop to false for ease of use when negotiating UI.
6050
self.splitter2.TabStop=0
6151

@@ -67,7 +57,7 @@ def __init__(self):
6757

6858
# Set TabStop to false for ease of use when negotiating UI.
6959
self.splitter1.TabStop=0
70-
60+
7161
# Add the appropriate controls to the Panel.
7262
foritemin (self.richTextBox1,self.splitter2,self.listView1):
7363
self.panel1.Controls.Add(item)
@@ -87,12 +77,11 @@ def Dispose(self):
8777
WinForms.Form.Dispose(self)
8878

8979

90-
9180
defmain():
9281
app=Splitter()
9382
WinForms.Application.Run(app)
9483
app.Dispose()
9584

85+
9686
if__name__=='__main__':
9787
main()
98-

‎demo/wordpad.py

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# ===========================================================================
2-
# This software is subject to the provisions of the Zope Public License,
3-
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
4-
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
5-
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
6-
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
7-
# FOR A PARTICULAR PURPOSE.
8-
# ===========================================================================
9-
101
importclr
112
importSystem.Windows.FormsasWinForms
123
fromSystem.ThreadingimportThread,ThreadStart,ApartmentState
@@ -60,18 +51,16 @@ def InitializeComponent(self):
6051
self.aboutMenu=WinForms.MenuItem()
6152
self.menuHelpAbout=WinForms.MenuItem()
6253

63-
6454
self.richTextBox=WinForms.RichTextBox()
6555
self.statusBarPanel1=WinForms.StatusBarPanel()
6656
self.statusBar=WinForms.StatusBar()
6757
self.fontDialog=WinForms.FontDialog()
6858
self.statusBarPanel1.BeginInit()
6959

70-
7160
# ===================================================================
7261
# File Menu
7362
# ===================================================================
74-
63+
7564
self.menuFileNew.Text="&New"
7665
self.menuFileNew.Shortcut=WinForms.Shortcut.CtrlN
7766
self.menuFileNew.ShowShortcut=False
@@ -83,7 +72,7 @@ def InitializeComponent(self):
8372
self.menuFileOpen.ShowShortcut=False
8473
self.menuFileOpen.Index=1
8574
self.menuFileOpen.Click+=self.OnClickFileOpen
86-
75+
8776
self.menuFileSave.Text="&Save"
8877
self.menuFileSave.Shortcut=WinForms.Shortcut.CtrlS
8978
self.menuFileSave.ShowShortcut=False
@@ -112,7 +101,6 @@ def InitializeComponent(self):
112101

113102
self.fileMenu.MenuItems.AddRange(items)
114103

115-
116104
# ===================================================================
117105
# Edit menu
118106
# ===================================================================
@@ -134,7 +122,7 @@ def InitializeComponent(self):
134122
self.menuEditCut.Shortcut=WinForms.Shortcut.CtrlX
135123
self.menuEditCut.Index=3
136124
self.menuEditCut.Click+=self.OnClickEditCut
137-
125+
138126
self.menuEditCopy.Text="Copy"
139127
self.menuEditCopy.Shortcut=WinForms.Shortcut.CtrlC
140128
self.menuEditCopy.Index=4
@@ -163,7 +151,6 @@ def InitializeComponent(self):
163151

164152
self.editMenu.MenuItems.AddRange(items)
165153

166-
167154
# ===================================================================
168155
# Format Menu
169156
# ===================================================================
@@ -184,11 +171,10 @@ def InitializeComponent(self):
184171

185172
self.formatMenu.MenuItems.AddRange(items)
186173

187-
188174
# ===================================================================
189175
# About menu
190176
# ===================================================================
191-
177+
192178
self.menuHelpAbout.Text="&About"
193179
self.menuHelpAbout.Index=0
194180
self.menuHelpAbout.Click+=self.OnClickHelpAbout
@@ -210,19 +196,16 @@ def InitializeComponent(self):
210196
self.richTextBox.AcceptsTab=1
211197
self.richTextBox.Location=System.Drawing.Point(0,0)
212198

213-
214199
self.statusBar.BackColor=System.Drawing.SystemColors.Control
215200
self.statusBar.Location=System.Drawing.Point(0,518)
216201
self.statusBar.Size=System.Drawing.Size(775,19)
217202
self.statusBar.TabIndex=1
218203
self.statusBar.ShowPanels=True
219204
self.statusBar.Panels.Add(self.statusBarPanel1)
220205

221-
222206
items= (self.fileMenu,self.editMenu,self.formatMenu,self.aboutMenu)
223207
self.mainMenu.MenuItems.AddRange(items)
224208

225-
226209
self.openFileDialog.Filter="Text documents|*.txt|RTF document|*.rtf"
227210
self.openFileDialog.Title="Open document"
228211

@@ -231,7 +214,6 @@ def InitializeComponent(self):
231214
self.saveFileDialog.Title="Save document"
232215
self.saveFileDialog.FileName="Untitled"
233216

234-
235217
self.AutoScaleBaseSize=System.Drawing.Size(5,13)
236218
self.ClientSize=System.Drawing.Size(775,537)
237219
self.Menu=self.mainMenu
@@ -244,7 +226,6 @@ def InitializeComponent(self):
244226
defDispose(self):
245227
self.components.Dispose()
246228
WinForms.Form.Dispose(self)
247-
248229

249230
defOnClickFileNew(self,sender,args):
250231
self.SaveChangesDialog()
@@ -265,7 +246,6 @@ def OnClickFileExit(self, sender, args):
265246
self.SaveChangesDialog()
266247
self.Close()
267248

268-
269249
defOnClickEditUndo(self,sender,args):
270250
self.richTextBox.Undo()
271251

@@ -284,7 +264,6 @@ def OnClickEditPaste(self, sender, args):
284264
defOnClickEditSelectAll(self,sender,args):
285265
self.richTextBox.SelectAll()
286266

287-
288267
defOnClickFormatWordWrap(self,sender,args):
289268
value=notself.word_wrap
290269
self.richTextBox.WordWrap=value
@@ -298,7 +277,6 @@ def OnClickFormatFont(self, sender, args):
298277
defOnClickHelpAbout(self,sender,args):
299278
AboutForm().ShowDialog(self)
300279

301-
302280
defNewDocument(self):
303281
self.doctype=1
304282
self.richTextBox.Rtf=''
@@ -327,7 +305,7 @@ def OpenDocument(self):
327305
stream.Close()
328306

329307
filename=self.filename=filename.lower()
330-
308+
331309
iffilename.endswith('.rtf'):
332310
self.richTextBox.Rtf=data
333311
self.doctype=2
@@ -345,10 +323,10 @@ def SaveDocument(self):
345323
ifself.saveFileDialog.ShowDialog()!=WinForms.DialogResult.OK:
346324
return
347325
filename=self.saveFileDialog.FileName
348-
326+
349327
filename=self.filename=filename.lower()
350328
self.Text='Python Wordpad - %s'%filename
351-
329+
352330
self.richTextBox.Select(0,0)
353331

354332
stream=File.OpenWrite(filename)
@@ -366,17 +344,16 @@ def SaveDocument(self):
366344
defSaveChangesDialog(self):
367345
ifself.richTextBox.Modified:
368346
ifWinForms.MessageBox.Show(
369-
"Save changes?","Word Pad",
370-
WinForms.MessageBoxButtons.OK|
371-
WinForms.MessageBoxButtons.YesNo
372-
)==WinForms.DialogResult.Yes:
347+
"Save changes?","Word Pad",
348+
WinForms.MessageBoxButtons.OK|
349+
WinForms.MessageBoxButtons.YesNo
350+
)==WinForms.DialogResult.Yes:
373351
self.SaveDocument()
374352
return1
375353
return0
376354

377355

378356
classAboutForm(WinForms.Form):
379-
380357
def__init__(self):
381358
self.InitializeComponent()
382359

@@ -406,7 +383,7 @@ def InitializeComponent(self):
406383
self.ClientSize=System.Drawing.Size(300,150)
407384

408385
self.Controls.AddRange((self.label1,self.btnClose))
409-
386+
410387
self.FormBorderStyle=WinForms.FormBorderStyle.FixedDialog
411388
self.MaximizeBox=0
412389
self.MinimizeBox=0
@@ -435,4 +412,3 @@ def main():
435412

436413
if__name__=='__main__':
437414
main()
438-

‎setup.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False):
110110

111111

112112
classPythonNET_BuildExt(build_ext):
113-
114113
defbuild_extension(self,ext):
115114
"""
116115
Builds the .pyd file using msbuild or xbuild.
@@ -191,7 +190,7 @@ def build_extension(self, ext):
191190
self._build_monoclr(ext)
192191

193192
def_get_manifest(self,build_dir):
194-
ifDEVTOOLS=="MsDev"andsys.version_info[:2]> (2,5):
193+
ifDEVTOOLS=="MsDev"andsys.version_info[:2]> (2,5):
195194
mt=_find_msbuild_tool("mt.exe",use_windows_sdk=True)
196195
manifest=os.path.abspath(os.path.join(build_dir,"app.manifest"))
197196
cmd= [mt,'-inputresource:"%s"'%sys.executable,'-out:"%s"'%manifest]
@@ -209,12 +208,12 @@ def _build_monoclr(self, ext):
209208

210209
# build the clr python module
211210
clr_ext=Extension("clr",
212-
sources=[
213-
"src/monoclr/pynetinit.c",
214-
"src/monoclr/clrmod.c"
215-
],
216-
extra_compile_args=cflags.split(" "),
217-
extra_link_args=libs.split(" "))
211+
sources=[
212+
"src/monoclr/pynetinit.c",
213+
"src/monoclr/clrmod.c"
214+
],
215+
extra_compile_args=cflags.split(" "),
216+
extra_link_args=libs.split(" "))
218217

219218
build_ext.build_extension(self,clr_ext)
220219

@@ -232,11 +231,10 @@ def _install_packages(self):
232231

233232

234233
classPythonNET_InstallLib(install_lib):
235-
236234
definstall(self):
237235
ifnotos.path.isdir(self.build_dir):
238236
self.warn("'%s' does not exist -- no Python modules to install"%
239-
self.build_dir)
237+
self.build_dir)
240238
return
241239

242240
ifnotos.path.exists(self.install_dir):
@@ -249,7 +247,6 @@ def install(self):
249247

250248

251249
classPythonNET_InstallData(install_data):
252-
253250
defrun(self):
254251
build_cmd=self.get_finalized_command("build_ext")
255252
install_cmd=self.get_finalized_command("install")
@@ -350,10 +347,9 @@ def _get_interop_filename():
350347
],
351348
zip_safe=False,
352349
cmdclass={
353-
"build_ext":PythonNET_BuildExt,
354-
"install_lib":PythonNET_InstallLib,
350+
"build_ext":PythonNET_BuildExt,
351+
"install_lib":PythonNET_InstallLib,
355352
"install_data":PythonNET_InstallData,
356353
},
357354
setup_requires=setup_requires
358355
)
359-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp