Meta:Samples/Software: Difference between revisions

From TSG Doc
Jump to navigation Jump to search
mNo edit summary
 
(68 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<!-- Introduction. What does this software do? Whom is it for? -->
{{Infobox software
Introduction.
| name                  = Software name
| logo                  = placeholder.png
| screenshot            =
| caption                = Software version X.X running on Windows X
| developer              =
| released              = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
| discontinued          =
| latest release version =
| latest release date    = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
| latest preview version =
| latest preview date    = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
| installed version      =
| installed version date = <!-- {{Start date and age|YYYY|MM|DD|df=yes}} -->
| status                = Active
| programming language  = Ruby
| operating system      = Microsoft Windows, Linux, MacOSX
| platform              =
| size                  =
| language              =
| genre                  =
| license                = [http://creativecommons.org/licenses/by-sa/4.0/ Creative Commons Attribution-ShareAlike 4.0]
| website                = [https://about.gitlab.com/ www.gitlab.nl]
| resources              =
  {{Infobox tsg
    | child              = yes
    | downloads          = {{bulleted list
      | {{Download link|media=placeholder.png|File on Wiki|type}}
      | {{Download link|https://www.ru.nl| File on external site|type}}
      | [https://www.ru.nl Link to external site]
    }}
    | manuals            = {{bulleted list
      | {{Download link|media=placeholder.png|File on Wiki|type}}
      | {{Download link|https://www.ru.nl| File on external site|type}}
      | [https://www.ru.nl Link to external site]
    }}
  }}
}}
 
Introduction. What does this software do? Who are the intended users?


<!-- Table of Contents will be generated here -->
<!-- Table of Contents will be generated here -->
Line 14: Line 52:
* Intel Core 2 Duo E8600 or higher.
* Intel Core 2 Duo E8600 or higher.
* Python
* Python


==Installation==
==Installation==
 
===Windows 11 64-bit===
===Windows 7 64-bit===
#Step 1
#Step 1
#Step 2
#Step 2
#Step 3
#Step 3


==Configuration==
==Configuration==
General settings.
General settings.
For CMD commands, you can use this format:<br/>
{{cmdline|ping 127.0.0.1 -n 50 -l 1024}}


=== License ===
License setup.


==Usage==
==Usage==
Templates and how-to's go here.
Templates and how-to's go here.


===Python===


===Template===
<syntaxhighlight lang="python" line>
 
#In the syntaxhighlight tag, change lang value to desired language.  
<syntaxhighlight lang="python">
#For the list of supported languages, see http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages
import time
from ctypes import windll, byref, c_char, Structure, WinError, POINTER, WINFUNCTYPE
from ctypes.wintypes import BOOL, HMONITOR, HDC, RECT, LPARAM, DWORD, BYTE, WCHAR, HANDLE
 
 
_MONITORENUMPROC = WINFUNCTYPE(BOOL, HMONITOR, HDC, POINTER(RECT), LPARAM)
 
class _PHYSICAL_MONITOR(Structure):
_fields_ = [('handle', HANDLE), ('description', WCHAR * 128)]
 
 
def _iter_physical_monitors(close_handles=True):
"""Iterates physical monitors.


The handles are closed automatically whenever the iterator is advanced.
def main():
This means that the iterator should always be fully exhausted!
    """Lots of useless code here."""
    if True:
        print "Hello, world!"
        return None # Explicitly returning None!
    else:
        raise Exception
if __name__ == "__main__":
    main()
</syntaxhighlight><br/>


If you want to keep handles e.g. because you need to store all of them and
<!-- Room for extra headers, like ==Course==, or ==Troubleshooting== -->
use them later, set `close_handles` to False and close them manually."""
 
def callback(hmonitor, hdc, lprect, lparam):
monitors.append(HMONITOR(hmonitor))
return True
 
monitors = []
if not windll.user32.EnumDisplayMonitors(None, None, _MONITORENUMPROC(callback), None):
raise WinError('EnumDisplayMonitors failed')
 
for monitor in monitors:
# Get physical monitor count
count = DWORD()
if not windll.dxva2.GetNumberOfPhysicalMonitorsFromHMONITOR(monitor, byref(count)):
raise WinError()
# Get physical monitor handles
physical_array = (_PHYSICAL_MONITOR * count.value)()
if not windll.dxva2.GetPhysicalMonitorsFromHMONITOR(monitor, count.value, physical_array):
raise WinError()
for physical in physical_array:
handle = physical.handle
 
# Get physical monitor capabilities. This may take a while...
length = DWORD()
if not windll.dxva2.GetCapabilitiesStringLength(HANDLE(handle), byref(length)):
raise WinError()
capabilities_string = (c_char * length.value)()
if not windll.dxva2.CapabilitiesRequestAndCapabilitiesReply(HANDLE(handle), capabilities_string, length):
raise WinError()
raw_capabilities = capabilities_string.value.decode('ascii')
capabilities = _parse_capabilities_string(raw_capabilities)
if capabilities:
# We only care about the model info for now.
yield [capabilities['model'], handle]
if close_handles:
if not windll.dxva2.DestroyPhysicalMonitor(handle):
raise WinError()
 
def _parse_capabilities_string(capabilities_string):
level = 0
capabilities = {}
open_p = {}
close_p = {0: 0}
id = {}
for i, chr in enumerate(capabilities_string):
if chr == '(':
if i == 0:
close_p[0] = 1
continue
open_p[level] = i
if level == 0:
id[0] = capabilities_string[close_p[0] + 1:i]
level += 1
elif chr == ')':
level -= 1
close_p[level] = i
if level == 0:
values = capabilities_string[open_p[0] + 1:i]
# We only care about the model info for now.
if id[0] == 'model':
capabilities[id[0]] = values
return capabilities
 
 
def set_vcp_feature(monitor, code, value):
"""Sends a DDC command to the specified monitor.
 
See this link for a list of commands:
ftp://ftp.cis.nctu.edu.tw/pub/csie/Software/X11/private/VeSaSpEcS/VESA_Document_Center_Monitor_Interface/mccsV3.pdf
"""
if not windll.dxva2.SetVCPFeature(HANDLE(monitor), BYTE(code), DWORD(value)):
raise WinError()
 
 
for model, handle in _iter_physical_monitors():
if model == "XL2420Z":
set_vcp_feature(handle, 0xDC, 12) # picture mode
time.sleep(2) # wait for picture mode to load
set_vcp_feature(handle, 0x10, 31) # brightness
set_vcp_feature(handle, 0x12, 50) # contrast
set_vcp_feature(handle, 0xF0, 0) # AMA (overdrive)
 
</syntaxhighlight>


==See Also== <!-- Optional -->
==See Also== <!-- Optional -->
*[[Meta:Templates/Hardware]]
*[[Project:Samples/Hardware|Samples/Hardware]]
 
*{{tl|Infobox_software}}
 
*{{tl|Infobox_tsg}}
<!-- Future content
==Notes==
{{reflist|group=note}}


==References== <!-- Optional, include only if <ref> tags are used in the article. -->
<references />


==References==
==External Links== <!-- Optional -->
{{reflist}}
*{{Official website|https://about.gitlab.com/}}
-->
*[http://tsgdoc.socsci.ru.nl tsgdoc]&nbsp;– Technical documentation.

Latest revision as of 15:10, 10 August 2026

Software name
Development statusActive
Written inRuby
Operating systemMicrosoft Windows, Linux, MacOSX
LicenseCreative Commons Attribution-ShareAlike 4.0
Websitewww.gitlab.nl
Downloads
Manuals

Introduction. What does this software do? Who are the intended users?


Features

This software is made to do this, it has these unique selling points:

  • Feature 1
  • Feature 2
  • Feature 3

Requirements

  • Microsoft Windows XP or later.
  • Intel Core 2 Duo E8600 or higher.
  • Python

Installation

Windows 11 64-bit

  1. Step 1
  2. Step 2
  3. Step 3

Configuration

General settings. For CMD commands, you can use this format:
ping 127.0.0.1 -n 50 -l 1024

License

License setup.

Usage

Templates and how-to's go here.

Python

#In the syntaxhighlight tag, change lang value to desired language. 
#For the list of supported languages, see http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages

def main():
    """Lots of useless code here."""
    if True:
        print "Hello, world!"
        return None # Explicitly returning None!
    else:
        raise Exception
 
if __name__ == "__main__":
    main()



See Also

References


External Links