| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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 | - | ||
| 10 | 1 | import clr | |
| 2 | + | ||
| 11 | 3 | SWF = clr.AddReference("System.Windows.Forms") | |
| 12 | 4 | print (SWF.Location) | |
| 13 | 5 | import System.Windows.Forms as WinForms | |
@@ -31,7 +23,7 @@ def __init__(self): | |||
| 31 | 23 | self.button.Size = Size(820, 20) | |
| 32 | 24 | self.button.TabIndex = 2 | |
| 33 | 25 | self.button.Text = "Click Me!" | |
| 34 | - | ||
| 26 | + | ||
| 35 | 27 | # Register the event handler | |
| 36 | 28 | self.button.Click += self.button_Click | |
| 37 | 29 | ||
@@ -41,7 +33,7 @@ def __init__(self): | |||
| 41 | 33 | self.textbox.TabIndex = 1 | |
| 42 | 34 | self.textbox.Size = Size(1260, 40) | |
| 43 | 35 | self.textbox.Location = Point(160, 24) | |
| 44 | - | ||
| 36 | + | ||
| 45 | 37 | # Add the controls to the form | |
| 46 | 38 | self.AcceptButton = self.button | |
| 47 | 39 | self.Controls.Add(self.button); | |
@@ -66,4 +58,3 @@ def main(): | |||
| 66 | 58 | ||
| 67 | 59 | if __name__ == '__main__': | |
| 68 | 60 | main() | |
| 69 | - | ||
| Original file line number | Diff line number | Diff 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 | - | ||
| 10 | 1 | import clr | |
| 11 | 2 | import System.Windows.Forms as WinForms | |
| 12 | 3 | from System.Drawing import Color, Size, Point | |
@@ -28,7 +19,6 @@ def __init__(self): | |||
| 28 | 19 | self.splitter2 = WinForms.Splitter() | |
| 29 | 20 | self.panel1 = WinForms.Panel() | |
| 30 | 21 | ||
| 31 | - | ||
| 32 | 22 | # Set properties of TreeView control. | |
| 33 | 23 | self.treeView1.Dock = WinForms.DockStyle.Left | |
| 34 | 24 | self.treeView1.Width = self.ClientSize.Width / 3 | |
@@ -48,14 +38,14 @@ def __init__(self): | |||
| 48 | 38 | ||
| 49 | 39 | # Set properties of Panel's Splitter control. | |
| 50 | 40 | self.splitter2.Dock = WinForms.DockStyle.Top | |
| 51 | - | ||
| 41 | + | ||
| 52 | 42 | # Width is irrelevant if splitter is docked to Top. | |
| 53 | 43 | self.splitter2.Height = 3 | |
| 54 | - | ||
| 44 | + | ||
| 55 | 45 | # Use a different color to distinguish the two splitters. | |
| 56 | 46 | self.splitter2.BackColor = Color.Blue | |
| 57 | 47 | self.splitter2.TabIndex = 1 | |
| 58 | - | ||
| 48 | + | ||
| 59 | 49 | # Set TabStop to false for ease of use when negotiating UI. | |
| 60 | 50 | self.splitter2.TabStop = 0 | |
| 61 | 51 | ||
@@ -67,7 +57,7 @@ def __init__(self): | |||
| 67 | 57 | ||
| 68 | 58 | # Set TabStop to false for ease of use when negotiating UI. | |
| 69 | 59 | self.splitter1.TabStop = 0 | |
| 70 | - | ||
| 60 | + | ||
| 71 | 61 | # Add the appropriate controls to the Panel. | |
| 72 | 62 | for item in (self.richTextBox1, self.splitter2, self.listView1): | |
| 73 | 63 | self.panel1.Controls.Add(item) | |
@@ -87,12 +77,11 @@ def Dispose(self): | |||
| 87 | 77 | WinForms.Form.Dispose(self) | |
| 88 | 78 | ||
| 89 | 79 | ||
| 90 | - | ||
| 91 | 80 | def main(): | |
| 92 | 81 | app = Splitter() | |
| 93 | 82 | WinForms.Application.Run(app) | |
| 94 | 83 | app.Dispose() | |
| 95 | 84 | ||
| 85 | + | ||
| 96 | 86 | if __name__ == '__main__': | |
| 97 | 87 | main() | |
| 98 | - | ||
| Original file line number | Diff line number | Diff 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 | - | ||
| 10 | 1 | import clr | |
| 11 | 2 | import System.Windows.Forms as WinForms | |
| 12 | 3 | from System.Threading import Thread, ThreadStart, ApartmentState | |
@@ -60,18 +51,16 @@ def InitializeComponent(self): | |||
| 60 | 51 | self.aboutMenu = WinForms.MenuItem() | |
| 61 | 52 | self.menuHelpAbout = WinForms.MenuItem() | |
| 62 | 53 | ||
| 63 | - | ||
| 64 | 54 | self.richTextBox = WinForms.RichTextBox() | |
| 65 | 55 | self.statusBarPanel1 = WinForms.StatusBarPanel() | |
| 66 | 56 | self.statusBar = WinForms.StatusBar() | |
| 67 | 57 | self.fontDialog = WinForms.FontDialog() | |
| 68 | 58 | self.statusBarPanel1.BeginInit() | |
| 69 | 59 | ||
| 70 | - | ||
| 71 | 60 | # =================================================================== | |
| 72 | 61 | # File Menu | |
| 73 | 62 | # =================================================================== | |
| 74 | - | ||
| 63 | + | ||
| 75 | 64 | self.menuFileNew.Text = "&New" | |
| 76 | 65 | self.menuFileNew.Shortcut = WinForms.Shortcut.CtrlN | |
| 77 | 66 | self.menuFileNew.ShowShortcut = False | |
@@ -83,7 +72,7 @@ def InitializeComponent(self): | |||
| 83 | 72 | self.menuFileOpen.ShowShortcut = False | |
| 84 | 73 | self.menuFileOpen.Index = 1 | |
| 85 | 74 | self.menuFileOpen.Click += self.OnClickFileOpen | |
| 86 | - | ||
| 75 | + | ||
| 87 | 76 | self.menuFileSave.Text = "&Save" | |
| 88 | 77 | self.menuFileSave.Shortcut = WinForms.Shortcut.CtrlS | |
| 89 | 78 | self.menuFileSave.ShowShortcut = False | |
@@ -112,7 +101,6 @@ def InitializeComponent(self): | |||
| 112 | 101 | ||
| 113 | 102 | self.fileMenu.MenuItems.AddRange(items) | |
| 114 | 103 | ||
| 115 | - | ||
| 116 | 104 | # =================================================================== | |
| 117 | 105 | # Edit menu | |
| 118 | 106 | # =================================================================== | |
@@ -134,7 +122,7 @@ def InitializeComponent(self): | |||
| 134 | 122 | self.menuEditCut.Shortcut = WinForms.Shortcut.CtrlX | |
| 135 | 123 | self.menuEditCut.Index = 3 | |
| 136 | 124 | self.menuEditCut.Click += self.OnClickEditCut | |
| 137 | - | ||
| 125 | + | ||
| 138 | 126 | self.menuEditCopy.Text = "Copy" | |
| 139 | 127 | self.menuEditCopy.Shortcut = WinForms.Shortcut.CtrlC | |
| 140 | 128 | self.menuEditCopy.Index = 4 | |
@@ -163,7 +151,6 @@ def InitializeComponent(self): | |||
| 163 | 151 | ||
| 164 | 152 | self.editMenu.MenuItems.AddRange(items) | |
| 165 | 153 | ||
| 166 | - | ||
| 167 | 154 | # =================================================================== | |
| 168 | 155 | # Format Menu | |
| 169 | 156 | # =================================================================== | |
@@ -184,11 +171,10 @@ def InitializeComponent(self): | |||
| 184 | 171 | ||
| 185 | 172 | self.formatMenu.MenuItems.AddRange(items) | |
| 186 | 173 | ||
| 187 | - | ||
| 188 | 174 | # =================================================================== | |
| 189 | 175 | # About menu | |
| 190 | 176 | # =================================================================== | |
| 191 | - | ||
| 177 | + | ||
| 192 | 178 | self.menuHelpAbout.Text = "&About" | |
| 193 | 179 | self.menuHelpAbout.Index = 0 | |
| 194 | 180 | self.menuHelpAbout.Click += self.OnClickHelpAbout | |
@@ -210,19 +196,16 @@ def InitializeComponent(self): | |||
| 210 | 196 | self.richTextBox.AcceptsTab = 1 | |
| 211 | 197 | self.richTextBox.Location = System.Drawing.Point(0, 0) | |
| 212 | 198 | ||
| 213 | - | ||
| 214 | 199 | self.statusBar.BackColor = System.Drawing.SystemColors.Control | |
| 215 | 200 | self.statusBar.Location = System.Drawing.Point(0, 518) | |
| 216 | 201 | self.statusBar.Size = System.Drawing.Size(775, 19) | |
| 217 | 202 | self.statusBar.TabIndex = 1 | |
| 218 | 203 | self.statusBar.ShowPanels = True | |
| 219 | 204 | self.statusBar.Panels.Add(self.statusBarPanel1) | |
| 220 | 205 | ||
| 221 | - | ||
| 222 | 206 | items = (self.fileMenu, self.editMenu, self.formatMenu, self.aboutMenu) | |
| 223 | 207 | self.mainMenu.MenuItems.AddRange(items) | |
| 224 | 208 | ||
| 225 | - | ||
| 226 | 209 | self.openFileDialog.Filter = "Text documents|*.txt|RTF document|*.rtf" | |
| 227 | 210 | self.openFileDialog.Title = "Open document" | |
| 228 | 211 | ||
@@ -231,7 +214,6 @@ def InitializeComponent(self): | |||
| 231 | 214 | self.saveFileDialog.Title = "Save document" | |
| 232 | 215 | self.saveFileDialog.FileName = "Untitled" | |
| 233 | 216 | ||
| 234 | - | ||
| 235 | 217 | self.AutoScaleBaseSize = System.Drawing.Size(5, 13) | |
| 236 | 218 | self.ClientSize = System.Drawing.Size(775, 537) | |
| 237 | 219 | self.Menu = self.mainMenu | |
@@ -244,7 +226,6 @@ def InitializeComponent(self): | |||
| 244 | 226 | def Dispose(self): | |
| 245 | 227 | self.components.Dispose() | |
| 246 | 228 | WinForms.Form.Dispose(self) | |
| 247 | - | ||
| 248 | 229 | ||
| 249 | 230 | def OnClickFileNew(self, sender, args): | |
| 250 | 231 | self.SaveChangesDialog() | |
@@ -265,7 +246,6 @@ def OnClickFileExit(self, sender, args): | |||
| 265 | 246 | self.SaveChangesDialog() | |
| 266 | 247 | self.Close() | |
| 267 | 248 | ||
| 268 | - | ||
| 269 | 249 | def OnClickEditUndo(self, sender, args): | |
| 270 | 250 | self.richTextBox.Undo() | |
| 271 | 251 | ||
@@ -284,7 +264,6 @@ def OnClickEditPaste(self, sender, args): | |||
| 284 | 264 | def OnClickEditSelectAll(self, sender, args): | |
| 285 | 265 | self.richTextBox.SelectAll() | |
| 286 | 266 | ||
| 287 | - | ||
| 288 | 267 | def OnClickFormatWordWrap(self, sender, args): | |
| 289 | 268 | value = not self.word_wrap | |
| 290 | 269 | self.richTextBox.WordWrap = value | |
@@ -298,7 +277,6 @@ def OnClickFormatFont(self, sender, args): | |||
| 298 | 277 | def OnClickHelpAbout(self, sender, args): | |
| 299 | 278 | AboutForm().ShowDialog(self) | |
| 300 | 279 | ||
| 301 | - | ||
| 302 | 280 | def NewDocument(self): | |
| 303 | 281 | self.doctype = 1 | |
| 304 | 282 | self.richTextBox.Rtf = '' | |
@@ -327,7 +305,7 @@ def OpenDocument(self): | |||
| 327 | 305 | stream.Close() | |
| 328 | 306 | ||
| 329 | 307 | filename = self.filename = filename.lower() | |
| 330 | - | ||
| 308 | + | ||
| 331 | 309 | if filename.endswith('.rtf'): | |
| 332 | 310 | self.richTextBox.Rtf = data | |
| 333 | 311 | self.doctype = 2 | |
@@ -345,10 +323,10 @@ def SaveDocument(self): | |||
| 345 | 323 | if self.saveFileDialog.ShowDialog() != WinForms.DialogResult.OK: | |
| 346 | 324 | return | |
| 347 | 325 | filename = self.saveFileDialog.FileName | |
| 348 | - | ||
| 326 | + | ||
| 349 | 327 | filename = self.filename = filename.lower() | |
| 350 | 328 | self.Text = 'Python Wordpad - %s' % filename | |
| 351 | - | ||
| 329 | + | ||
| 352 | 330 | self.richTextBox.Select(0, 0) | |
| 353 | 331 | ||
| 354 | 332 | stream = File.OpenWrite(filename) | |
@@ -366,17 +344,16 @@ def SaveDocument(self): | |||
| 366 | 344 | def SaveChangesDialog(self): | |
| 367 | 345 | if self.richTextBox.Modified: | |
| 368 | 346 | if WinForms.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: | ||
| 373 | 351 | self.SaveDocument() | |
| 374 | 352 | return 1 | |
| 375 | 353 | return 0 | |
| 376 | 354 | ||
| 377 | 355 | ||
| 378 | 356 | class AboutForm(WinForms.Form): | |
| 379 | - | ||
| 380 | 357 | def __init__(self): | |
| 381 | 358 | self.InitializeComponent() | |
| 382 | 359 | ||
@@ -406,7 +383,7 @@ def InitializeComponent(self): | |||
| 406 | 383 | self.ClientSize = System.Drawing.Size(300, 150) | |
| 407 | 384 | ||
| 408 | 385 | self.Controls.AddRange((self.label1, self.btnClose)) | |
| 409 | - | ||
| 386 | + | ||
| 410 | 387 | self.FormBorderStyle = WinForms.FormBorderStyle.FixedDialog | |
| 411 | 388 | self.MaximizeBox = 0 | |
| 412 | 389 | self.MinimizeBox = 0 | |
@@ -435,4 +412,3 @@ def main(): | |||
| 435 | 412 | ||
| 436 | 413 | if __name__ == '__main__': | |
| 437 | 414 | main() | |
| 438 | - | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,7 +110,6 @@ def _find_msbuild_tool(tool="msbuild.exe", use_windows_sdk=False): | |||
| 110 | 110 | ||
| 111 | 111 | ||
| 112 | 112 | class PythonNET_BuildExt(build_ext): | |
| 113 | - | ||
| 114 | 113 | def build_extension(self, ext): | |
| 115 | 114 | """ | |
| 116 | 115 | Builds the .pyd file using msbuild or xbuild. | |
@@ -191,7 +190,7 @@ def build_extension(self, ext): | |||
| 191 | 190 | self._build_monoclr(ext) | |
| 192 | 191 | ||
| 193 | 192 | def _get_manifest(self, build_dir): | |
| 194 | - if DEVTOOLS == "MsDev" and sys.version_info[:2] > (2,5): | ||
| 193 | + if DEVTOOLS == "MsDev" and sys.version_info[:2] > (2, 5): | ||
| 195 | 194 | mt = _find_msbuild_tool("mt.exe", use_windows_sdk=True) | |
| 196 | 195 | manifest = os.path.abspath(os.path.join(build_dir, "app.manifest")) | |
| 197 | 196 | cmd = [mt, '-inputresource:"%s"' % sys.executable, '-out:"%s"' % manifest] | |
@@ -209,12 +208,12 @@ def _build_monoclr(self, ext): | |||
| 209 | 208 | ||
| 210 | 209 | # build the clr python module | |
| 211 | 210 | 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(" ")) | ||
| 218 | 217 | ||
| 219 | 218 | build_ext.build_extension(self, clr_ext) | |
| 220 | 219 | ||
@@ -232,11 +231,10 @@ def _install_packages(self): | |||
| 232 | 231 | ||
| 233 | 232 | ||
| 234 | 233 | class PythonNET_InstallLib(install_lib): | |
| 235 | - | ||
| 236 | 234 | def install(self): | |
| 237 | 235 | if not os.path.isdir(self.build_dir): | |
| 238 | 236 | self.warn("'%s' does not exist -- no Python modules to install" % | |
| 239 | - self.build_dir) | ||
| 237 | + self.build_dir) | ||
| 240 | 238 | return | |
| 241 | 239 | ||
| 242 | 240 | if not os.path.exists(self.install_dir): | |
@@ -249,7 +247,6 @@ def install(self): | |||
| 249 | 247 | ||
| 250 | 248 | ||
| 251 | 249 | class PythonNET_InstallData(install_data): | |
| 252 | - | ||
| 253 | 250 | def run(self): | |
| 254 | 251 | build_cmd = self.get_finalized_command("build_ext") | |
| 255 | 252 | install_cmd = self.get_finalized_command("install") | |
@@ -350,10 +347,9 @@ def _get_interop_filename(): | |||
| 350 | 347 | ], | |
| 351 | 348 | zip_safe=False, | |
| 352 | 349 | cmdclass={ | |
| 353 | - "build_ext" : PythonNET_BuildExt, | ||
| 354 | - "install_lib" : PythonNET_InstallLib, | ||
| 350 | + "build_ext": PythonNET_BuildExt, | ||
| 351 | + "install_lib": PythonNET_InstallLib, | ||
| 355 | 352 | "install_data": PythonNET_InstallData, | |
| 356 | 353 | }, | |
| 357 | 354 | setup_requires=setup_requires | |
| 358 | 355 | ) | |
| 359 | - | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments